Tell me o/p of the mentioned code fragment.String s1 = "shailesh";String s2="shailesh";System.out.println(s1.equals(s2));System.out.println(s1==s2);

Answer is
true
true

Every time we make any string constant same memory referenced will be assigned if the string constant is same. That's why both obj. s1 and s2 refer to same memory.

 

This Question is not yet answered!

 
 

Related Answered Questions

 

Related Open Questions