when i write
string s1="java";
in one program(application) and
string s2="java";
in another application
on the same jvm will both objects s2,s2 will refer to same
memory location where "java" is stored
in string pool.

Answers were Sorted based on User's Feedback



when i write string s1="java"; in one program(application) and string s2="java&q..

Answer / ss

String s1="java";
String s2="java";
System.out.println(s1.equals(s2)); -->true
System.out.println(s1==s2); --->true

Is This Answer Correct ?    6 Yes 3 No

when i write string s1="java"; in one program(application) and string s2="java&q..

Answer / tj

Yes,They will refer to same memory location..

Is This Answer Correct ?    2 Yes 2 No

Post New Answer

More Core Java Interview Questions

Explain why wait(), notify() and notifyall() methods are in object class rather than in thread class?

0 Answers  


What is the difference between constructor and method?

4 Answers  


What is onClassLoader in java?

5 Answers   Cap Gemini,


why abstract class does not have object creation

6 Answers   Value Labs,


What is java reflection api?

0 Answers  






Can two objects have same hashcode?

0 Answers  


Are arrays classes in java?

0 Answers  


How do you declare an array in java?

0 Answers  


What exactly is java?

0 Answers  


What is the maximum size of array in java?

0 Answers  


Read data from console and print in one file. That would be in C:\temp ? Thanks, Bose

3 Answers   Oracle, Surya Software,


What is the synonym of string?

0 Answers  


Categories