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
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

Step by step
Solved in 2 steps with 1 images








