Question: JAVA import java.util.ArrayList; public class ArrayListExcercise { public static void main(String[] args) { ArrayList colors = colors.add(Red); new ArrayList (); //Task 1 Add 3 more

JAVA import java.util.ArrayList; public class ArrayListExcercise { public static void main(String[] args)JAVA

import java.util.ArrayList; public class ArrayListExcercise { public static void main(String[] args) { ArrayList colors = colors.add("Red"); new ArrayList (); //Task 1 Add 3 more colors to the list // Task 2 Create a new ArrayList called numbers //- this should be of type Integer //Task 3 Add 3 values to to your new ArrayList //-The size method returns the length of the Array // - e.g. colors.size() //Task 4 print the size of the Array //Task 5 Use a for each loop to print, //all of the elements in the colors array //Task 6 Use the following methods with one of your ArrayLists //Explain what happens with a line comment beside each //add (2, value) //remove(int index) //clear() //is Empty //set(0, "") //Advanced - addAll(int index, Collection c) } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!