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
Define max and min heap, also the search time of heap.
What is currentthread()?
What is package protected in java?
What is foreach loop in java?
Explain methods specific to list interface?
How can you make a class serializable in java?
What are namespaces in java?
Is ++ operator thread-safe in java?
What is the use of using enum to declare a constant?
How does finally block differ from finalize() method?
Is null a keyword in java?
What is an iterator java?
What is a native method in java programming?
What is a flag and how does it work?
Does java map allow duplicates?