Closed erhem1 closed 5 years ago
Complete the following Java code so that the output looks like the following. And Test the outputs
Output [Lion, Tiger, Cat, Dog] [Lion, Tiger, Elephant, Cat, Dog]
Java Code to Complete import java.util.ArrayList; import java.util.List;
public class CreateArrayListExample {
public ArrayList createArrayList() { // Creating an ArrayList of String with name animals
// Adding new elements to the ArrayList // Adding an element at the particular index in an ArrayList
} }
Complete the following Java code so that the output looks like the following. And Test the outputs
Output [Lion, Tiger, Cat, Dog] [Lion, Tiger, Elephant, Cat, Dog]
Java Code to Complete import java.util.ArrayList; import java.util.List;
public class CreateArrayListExample {
public ArrayList createArrayList() { // Creating an ArrayList of String with name animals
} }