Core Java - Interview Questions and Answers for 'Equals method' | Search Java Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Core Java - Interview Questions and Answers for 'Equals method' - 2 question(s) found - Order By Newest

 Q1. In Java, if object A contains same the same data of object B, are they equal?Core Java2017-04-23 19:11:04

Ans. it depends on the implementation of equals method of the respective class. If no definition is provided and it uses the default definition of the object class, two references are equal only if they point to the same object.

We can have such an equality defined for a particular class objects if we provide appropriate implementation of equals method comparing all those fields.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     equals  equals method


Related Questions

  Difference between == and .equals() ?
  Which String class does not override the equals() and hashCode() methods, inheriting them directly from class Object?
  Can we compare Integers by using equals() in Java ?
 Write a class and override the equals and hashcode method ?
 What is equals method in Java ?
 What is a reflexive equals contract ?
 Explain Transitive equals contract.
 why is "".equals(str); safer than str.equals("")?
 Difference between equals and compareTo in Java ?


 Q2. why is "".equals(str); safer than str.equals("")?Core Java2019-01-31 20:34:18

 This question was recently asked at 'Glory Global Solutions'.This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     equals method     Asked in 1 Companies


Related Questions

 In Java, if object A contains same the same data of object B, are they equal?
 What is equals method in Java ?


 Q3. Which of the following is false ?Core Java
a. A Class cannot override both hashcode and equals method.
b. A class can override both hashcode and equals method.
c. A Class must override hashCode method if its overridding equal method.
d. A Class can override hashCode even if its not overridding equals method.

Ans.a. A Class cannot override both hashcode and equals method.


Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: