What is the output of this Java program?
public class Main {
public static void main(String[] args) {
String a = new String("hi");
String b = new String("hi");
System.out.print((a == b) + " " + a.equals(b));
}
}Solution
== compares references; two new String objects are different objects. equals() compares content.