-
What is the output of this program?
import java.util.*;
public class ArraylistExample
{
public static void main(String args[])
{
ArrayList object0 = new ArrayList();
ArrayList object1 = new ArrayList();
object0.add("I");
object0.add("P");
object1.add("I");
object1.add(1, "P");
System.out.println(object0.equals(object1));
}
}
-
- I
- P
- L
- False
- True
Correct Option: E
object0 and object1 are an object of class ArrayList hence it is a dynamic array which can increase and decrease its size. object.add(“N”) adds to the array element N and object.add(1,”N”) adds element N at index position 1 in the list, Both the objects object0 and object1 contain same elements i:e I & P thus object0.equals(object1) method returns false.