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
Give the difference between the println method and sqrt method?
What is palindrome in java?
how to write a program for sending mails between client and server
What is the ==?
Explain the pointers in Java?
What is empty list in java?
Why to use nested classes in java? (Or) what is the purpose of nested class in java?
What are aggregate functions explain with examples?
Is java still necessary?
what is the constructor and how many types of constructors are used in java?
Can we have multiple classes in a single file?
How to split arraylist elements in java?
What does it mean that a class or member is final?
What is string pooling concept?
What is difference between next () and nextline () in java?