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

Can we create an object of private class?

0 Answers  


Explain role of constructor in a java application?

5 Answers  


What is the difference between static (class) method and instance method?

0 Answers  


Can this keyword be used to refer static members?

0 Answers  


did interface can implementation method ? i know its not possible but my interviewer said its possible ..but how..? any one have idea ???

7 Answers   IBM,


When should we create our own custom exception classes?

0 Answers  


What is the use of java?

0 Answers  


What classes of exceptions, caught by a catch clause?

1 Answers  


how u do unit testing?

2 Answers   iFlex,


Can a function return a function?

0 Answers  


How do you do exponents in java?

0 Answers  


int a=1,b=10; System.out.println(a+b--);

12 Answers   HCL,


Categories