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 all access modifiers are allowed for top class ?
Differentiate between static and non-static methods in java.
explain autoboxing in java?
What is floor math?
Is java code slower than native code?
define the terminology association.
how to create multithreaded program? Explain different ways of using thread? When a thread is created and started, what is its initial state? Or extending thread class or implementing runnable interface. Which is better? : Java thread
How many bytes is a char in java?
Difference between error and exception
What does mean in regex?
Why do we use bufferedreader?
Explain methods specific to list interface?
Which package is always imported by default?
How to connect to a remote database using Applet?
What is the return type of the main method?