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
Can we have this () and super () together?
What is a nested structure?
Which sorting is used in arrays sort in java?
What is collections framework?
What are the various access specifiers in java?
Can you inherit from an abstract class java?
what do you mean by classloader in java?
write a program that list all permutations of ABCDEF in which A appears before B?
What is java jit compilers?
How many times finalize method will be invoked? Who invokes finalize() method in java?
What is final keyword in java? Give an example.
Difference between abstract and concrete class ?
How can we create a thread in java?
How many characters is 2 bytes?
What is a functional interface?