exam questions

Exam 1z0-809 All Questions

View all questions & answers for the 1z0-809 exam

Exam 1z0-809 topic 1 question 144 discussion

Actual exam question from Oracle's 1z0-809
Question #: 144
Topic #: 1
[All 1z0-809 Questions]

Given the code fragments:
and

Which two modifications enable to sort the elements of the emps list? (Choose two.)

  • A. Replace line n1 with class Person extends Comparator<Person>
  • B. At line n2 insert public int compareTo (Person p) { return this.name.compareTo (p.name); }
  • C. Replace line n1 with class Person implements Comparable<Person>
  • D. At line n2 insert public int compare (Person p1, Person p2) { return p1.name.compareTo (p2.name); }
  • E. At line n2 insert: public int compareTo (Person p, Person p2) { return p1.name.compareTo (p2.name); }
  • F. Replace line n1 with class Person implements Comparator<Person>
Show Suggested Answer Hide Answer
Suggested Answer: BC 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
DarGrin
1 week, 3 days ago
Selected Answer: BC
Anser is B and C, since class Person should implement Comparable Interface and implement its method : int compareTo(T o)
upvoted 1 times
...
steefaand
4 months, 1 week ago
Selected Answer: BC
B and C are true.
upvoted 1 times
...
samtash1034
2 years, 5 months ago
b,c,tested
upvoted 1 times
...
Manuel7000
3 years, 2 months ago
Agree and tested
upvoted 3 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago