what is the difference between equals method and ==
Answer Posted / ramanareddy333
equal method compare the the content of the strings,where
as == compares the referance variables .
for example
string s1 = 'ramana'
string s2= ' ramana'
if(s1==s2)
s.o.p("s1, s2 are same");
else
s.o.p(" s1, s2 are not same");
ans = s1,s2 are not same because == compares the referance
variables.
| Is This Answer Correct ? | 6 Yes | 8 No |
Post New Answer View All Answers
what do you understand by the term string with respect to java?
What is difference between overloading and overriding in java?
Which sorting is best in java?
What is the difference between multitasking and multithreading in Java
What is the list interface in java programming?
Can java hashmap have duplicate keys?
Why we use multi threading instead of multiprocessing?
Why are the destructors for base class and derived class called in reverse order when the program exits
Which collection is best for sorting in java?
What is the java reflection api? Why it’s so important to have?
What is the difference between jdk, jre, and jvm?
what is server side caching?
Can a class with private constructor be extended?
Can you add null to a list java?
Does unicode support all languages?