what is the difference between equals method and ==
Answer Posted / rajender
The Object class equals method refers address comparision.
Person p=new Person();
Person p1=new Person();
if(p.equals(p1){
//is always false.
}
the string class equals method refers content comparision
String p=new String ("java");
String p1=new String ("java");
if(p.equals(p1){
//is always true.
}
Dn't get confusion
| Is This Answer Correct ? | 5 Yes | 1 No |
Post New Answer View All Answers
How many bytes is a string?
What are the different types of collections in java?
Can substring create new object?
Explain scope or life time of local variables in java?
How do you define a parameter?
Explain the importance of finalize() method.
What are the drawbacks for singleton class?
Explain about strings in java?
What is meant by interface?
What is the parse method in java?
What is an accessor?
What is the collections api?
Explain where variables are created in memory?
What is a numeric string?
Explain working of call by reference function invoking.