1Z0-804 · Question #3
Given: What is the result?
The correct answer is A. false false. (this == obj) is the object implementation of equals() and therefore FALSE, if the reference points to variousobjectsand then the super.equals() is invoked, the object method equals() what still result in FALSEbetter override of equals() is to compare the attributes like…
Question
Given:
What is the result?
Exhibit
Options
- Afalse false
- Btrue false
- Ctrue true
- DCompilation fails
- EAn exception is thrown at runtime
How the community answered
(45 responses)- A80% (36)
- B2% (1)
- C2% (1)
- D11% (5)
- E4% (2)
Explanation
(this == obj) is the object implementation of equals() and therefore FALSE, if the reference points to variousobjectsand then the super.equals() is invoked, the object method equals() what still result in FALSEbetter override of equals() is to compare the attributes like: public boolean equals (Object obj) { if (obj != null){ Product p = (Product)obj; return this.id == p.id;
Topics
Community Discussion
No community discussion yet for this question.
