Oracle
1Z0-809 · Question #77
1Z0-809 Question #77: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-809 to reveal the answer and full explanation for question #77. The question stem and answer options stay visible for context.
Question
Given:
class CheckClass {
public static int checkValue (String s1, String s2) {
return s1.length() ?s2.length();
}
}
and the code fragment:
String[] strArray = new String [] {"Tiger", "Rat", "Cat", "Lion"}
//line n1
for (String s : strArray) {
System.out.print (s + " ");
}
Which code fragment should be inserted at line n1 to enable the code to print Rat Cat Lion Tiger?
Options
- AArrays.sort(strArray, CheckClass :: checkValue);
- BArrays.sort(strArray, (CheckClass :: new) :: checkValue);
- CArrays.sort(strArray, (CheckClass :: new).checkValue);
- DArrays.sort(strArray, CheckClass :: new :: checkValue);
Unlock 1Z0-809 to see the answer
You've previewed enough free 1Z0-809 questions. Unlock 1Z0-809 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.