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 JVMs can run on a single machine and what is the meaning of Just-In-Time (JIT) compiler?
Does java allow default arguments?
What is instance means in java?
Difference between vector and arraylist.
When we serialize an object does the serialization mechanism saves its references too?
Give differences between Quicksort &Mergesort. When should these sorts be used andwhat is their running time in java?
Explain the meaning of java applet.
Explain about the main() method in java?
In Java list the methods that can be overridden?
What is a copy constructor in java?
Explain the difference between throw and throws in java?
Can we sort array in java?
Can you change array size in java?
What is string manipulation?
Is nullpointerexception checked or unchecked?