String a = new String("hi");
String b = new String("hi");
System.out.println(a.equals(b));What is printed?
- A
0
- B
false
- Ccheck_circle
true
- D
Error
Explanation
The equals method compares the contents of the strings; both contain "hi", so it returns true.