Oracle Certified Professional Java Se 11 Developer · Free Practice Question Hard

Question 69

Question ID: UKOCP68695


What will be the result of compiling and executing Test class?

  • A [Point(2, 2), Point(4, 5), Point(6, 7)]
  • B [Point(6, 7), Point(4, 5), Point(2, 2)]
  • C [Point(4, 5), Point(6, 7), Point(2, 2)]
  • D Compilation error
Reveal correct answer

Correct answer: D

Explanation

UKOCP68695:

Comparator interface has compare(...) method and not compareTo(...) method.

Anonymous inner class's syntax doesn't implement compare(...) method and thus compilation error.


Make sure to check the accessibility and interface method details before working with the logic.

Discussion

Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.

You must be logged in to post a comment.

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need