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
What is maximum size of arraylist in java?
What is difference between class and object in java?
How the interruptible method gets implemented?
How to access arraylist elements in java?
In the below example, what will be the output?
Is a class an object?
what is the difference between preemptive scheduling and time slicing? : Java thread
What is the benefit of abstract class?
What is 16 bits called?
Hi friends am new to java. I read jar file means collection of java files. For executing struts application what are the necessary jar files. " struts.jar " file contains what. can u explain
Is logger a singleton?
What is the major difference between linkedlist and arraylist?
Are arrays static in java?
Does java initialize arrays to zero?
Why webdriver is an interface?