Discussion
Which of these statements about what the equals method must accept as its parameter to override Object.equals is correct?
Answer: D
Overriding requires the same signature, so public boolean equals(Point p) is a new overload and Object.equals is left in place. Collections call the inherited version through an Object reference, so the intended logic is never reached. Adding @Override turns the mistake into a compile error.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development