A. wrong
public int compare(T o1, T o2) - must be implemeted
B. wrong
Because it missed generic type parameter
should have Object type arguments
public int compare (Object obj1, Object obj2)
C. correct
Anonymous with interface implementation
Generic type parameter is String and method compare with String arguments
D. wrong
wrong return type
answer: AC
A and C are the same
Anonymous with interface
as a result there is a valid comparable implementation
D failed
wrong return type
B failed
should have raw type arguments
public int compare (Object obj1, Object obj2) {
Correct answer is C .
//A is invalid because :The type new Comparator<String>(){} must implement the inherited abstract method Comparator<String>.compare(String, String)
//B is invalid because : The type Comps must implement the inherited abstract method Comparator.compare(Object, Object)
//D is invalid because : The return type is incompatible with Comparator.compare(Object, Object) and Illegal modifier for the local class Comps; only abstract or final is permitted
This section is not available anymore. Please use the main Exam Page.1z0-819 Exam Questions
Log in to ExamTopics
Sign in:
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.
ASPushkin
4 months agoASPushkin
7 months, 2 weeks agoASPushkin
7 months, 2 weeks agognilapon.ebenezaire
9 months, 1 week agod7bb0b2
1 year, 4 months agoStavok
1 year, 10 months agoMukes877
1 year, 10 months agopikosss
2 years, 1 month agoTADIEWA
2 years, 3 months ago