Oracle Java SE 8 Programmer II 1z0-809 Question # 25 Topic 3 Discussion

Oracle Java SE 8 Programmer II 1z0-809 Question # 25 Topic 3 Discussion

1z0-809 Exam Topic 3 Question 25 Discussion:
Question #: 25
Topic #: 3

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?


A.

Arrays.sort(strArray, CheckClass : : checkValue);


B.

Arrays.sort(strArray, (CheckClass : : new) : : checkValue);


C.

Arrays.sort(strArray, (CheckClass : : new).checkValue);


D.

Arrays.sort(strArray, CheckClass : : new : : checkValue);


Get Premium 1z0-809 Questions

Contribute your Thoughts:


Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.