Question: What will the output be of the code above? Out 4: Choose... Out 6: Choose... String[] colors= {red, green, blue}; ArrayList list = new
What will the output be of the code above? Out 4: Choose... Out 6: Choose... String[] colors= {"red", "green", "blue"}; ArrayList list = new ArrayList (Arrays.asList(colors)); System.out.println("Out 1: " + list.isEmpty()); list.add(1, "black"); list.add(1, "cyan"); System.out.println("Out 2: "+list); System.out.println("Out 3: "+list.remove(2)); System.out.println("Out 4: "+list); System.out.println("Out 5: Contain value: "+list.contains("black")); Collections.reverse(list); System.out.println("Out 6: "+list);
Step by Step Solution
3.45 Rating (155 Votes )
There are 3 Steps involved in it
Lets break down the code and see what the output will be java String colors red green blue ArrayList ... View full answer
Get step-by-step solutions from verified subject matter experts
