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
Are maps ordered java?
Is the empty set a singleton?
How many types of gc are there in java?
What is thread safe in java?
What does a boolean method return?
Are global variables initialized to zero?
What are predicates in java 8?
Mention some interfaces implemented by linked list in java.
What is the use of predicate in java 8?
What are three advantages of using functions?
Why does java doesnt suuport unsigned values?
How do you input a string in java?
What does exclamation mean in java?
What is string immutability?
How does varargs work in java?