What is the output of the following code?
import java.util.*;
class Main
{
public static void main(String args[])
{
ArrayList mylist = new ArrayList();
mylist.add("C");
mylist.add("H");
ArrayList mylist2 = new ArrayList();
mylist2.add("C");
mylist2.add(1, "H");
System.out.println(mylist.equals(mylist2));
}
}
Answers
Answered by
1
Answer:
c
Explanation:
this is a right answer
Answered by
0
Output:
TRUE
Here, there are 2 array lists and each list contains two Letters "C" and "H".
after comparing the list item output is being printed.
".equals" is a method which returns True if the values are same and return False if the values are not same and here the two array list have the same values so the output will be true.
Similar questions