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 to sort array of 0 and 1 in java?
What is jee6?
What is a layout manager and what are different types of layout managers available in java awt?
What is a methodologist?
Which of the following classes will have more memory allocated?
What is java regex?
What is the difference between an if statement and a switch statement?
What means public static?
How does enum work in java?
Is it possible to write a regular expression to check if string is a number?
What is string in java is it a data type?
How many bits is a word?
How do you remove duplicates in java?
What is variable argument in java?
What is a cup of java?