Fidelity Investments Interview Question

The question is from string. class Test { public static void main(String args[]) { String t1 = "Auto"; String t2 = "Auto"; System.out.println(t1==t2) //Line1 String x1=new String("Java"); String x2 =new String("Java"); System.out.println(x1==x2); //Line 2 } } What is the output of Line 1 and Line2

Interview Answer

Anonymous

Oct 5, 2019

Line1 : True Line2: False