|
![]() |
Ramakrishna wrote:
here s7=s6+"me";
s4 and s7 are equal but it is showing false...why...
one of my friend told s7 stores in heap.....
Everyday in every way, we get a little better.
Bobby Smallman wrote:http://leepoint.net/notes-java/data/expressions/22compareobjects.html
Ramakrishna wrote:What does the == operator do?
== operator compares two references of a string.
What is a String? Where in memory does it live?
String is a set/combinations of characters.
String s; s="ab"; //this will store in stack
String s= new String("ab"); //this will store in heap
.............
this is my expectation
.................
What do you want to do with the two Strings?
just i want to compare two strings.
my doubt is
String s6 = "change ";
String s7 = s6+"me";
s4==s7
should be true....
but it is getting false....what would be the reason.......
Regards,
Sudipta Kumar Laha
SCJP6.0,My blog Ranchers from Delhi
Campbell Ritchie wrote:"Ramakrishna" it is not possible to send you a private message to warn you about the naming policy, but you are still in violation of it.
Correct your displayed name to match the policy, or we shall withdraw your privilege of using this website.