what is the difference between equals method and ==
Answer Posted / chanchal verma
== compares the reference values whether they are pointing to the same object or not. equals() method compares the contents of two objects.
Ex.
String s1=new String("chanchal");
String s2=new String("chanchal");
System.out.println(s1==s2);// prints false
System.out.println(s1.equals(s2));
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is generic class?
What is the difference between static class and normal class?
What are the two types of java?
Why is string class considered immutable?
What is nan inf?
Where is the find and replace?
What is difference between module and function?
Explain about doubly linked list
Can list have duplicates in java?
Explain the importance of finalize() method.
How you can force the garbage collection?
What is the Difference between Final Class && Abstract Class?
What is the use of protected in java?
List some features of the abstract class.
What is the benefit of singleton pattern?