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

What is the Concept of Encapsulation in OOPS

0 Answers   HCL,


What is abstraction in java?

0 Answers   Akamai Technologies,


Does a function need a return?

0 Answers  


Is string a keyword in java?

1 Answers  


what is default constructor and parameterised constructor with example?

1 Answers   KPIT,






What are the Main functions of Java?

0 Answers   Akamai Technologies,


What is string syntax?

0 Answers  


What does java edition mean?

0 Answers  


What is the destroy method?

0 Answers  


What is thread safe in java?

0 Answers  


Can a class be declared as protected?

0 Answers  


what is synchronization

3 Answers  


Categories