Integer numSize is read from input. ArrayList colorsList contains numSize strings read from input. Complete the enhanced for loop to output each value in colorsList. Ex: If the input is: 5 blue red violet green orange then the output is: blue is available red is available violet is available green is available orange is available import java.util.Scanner;import java.util.ArrayList; public class Colors {   public static void main(String[] args) {      Scanner scnr = new Scanner(System.in);      ArrayList<String> colorsList = new ArrayList<String>();      int numSize;      int i;       numSize = scnr.nextInt();      for (i = 0; i < numSize; ++i) {         colorsList.add(scnr.next());      }            for (/* Your code goes here */) {         System.out.println(colorVal + " is available");      }   }} java please

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter9: Advanced Array Concepts
Section: Chapter Questions
Problem 19RQ
icon
Related questions
Question

Integer numSize is read from input. ArrayList colorsList contains numSize strings read from input. Complete the enhanced for loop to output each value in colorsList.

Ex: If the input is:

5 blue red violet green orange

then the output is:

blue is available red is available violet is available green is available orange is available

import java.util.Scanner;
import java.util.ArrayList;

public class Colors {
   public static void main(String[] args) {
      Scanner scnr = new Scanner(System.in);
      ArrayList<String> colorsList = new ArrayList<String>();
      int numSize;
      int i;

      numSize = scnr.nextInt();
      for (i = 0; i < numSize; ++i) {
         colorsList.add(scnr.next());
      }
      
      for (/* Your code goes here */) {
         System.out.println(colorVal + " is available");
      }
   }
}

java please 

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Map
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT