What is output of the following code:
ArrayList list = new ArrayList();
String s1 = new String("Java");
String s2 = new String("Java");
list.add(s1);
list.add(s2);
System.out.println((list.get(0) == list.get(1)) + " " + (list.get(0)).equals(list.get(1)));
A. true false
B. false true
C. true true
D. false false
The correct answer is B
Explanation: list.get(0) and list.get(1) point to two different objects with the same string contents.