Oracle
1Z0-851 · Question #7
1Z0-851 Question #7: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-851 to reveal the answer and full explanation for question #7. The question stem and answer options stay visible for context.
Question
Given: import java.util.*; public class SortOf { public static void main(String[] args) { ArrayList<Integer> a = new ArrayList<Integer>(); a.add(1); a.add(5); a.add(3); Collections.sort(a); a.add(2); Collections.reverse(a); System.out.println(a); } } What is the result?
Options
- A[1, 2, 3, 5]
- B[2, 1, 3, 5]
- C[2, 5, 3, 1]
- D[5, 3, 2, 1]
- E[1, 3, 5, 2]
- FCompilation fails.
- HAn exception is thrown at runtime.
Unlock 1Z0-851 to see the answer
You've previewed enough free 1Z0-851 questions. Unlock 1Z0-851 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.