Oracle
1Z0-805 · Question #41
1Z0-805 Question #41: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-805 to reveal the answer and full explanation for question #41. The question stem and answer options stay visible for context.
Question
Given: import java.util.*; public class StringApp { public static void main (String [] args) { Set <String> set = new TreeSet <> (); set.add("X"); set.add("Y"); set.add("X"); set.add("Y"); set.add("X"); Iterator <String> it = set.iterator (); int count = 0; while (it.hasNext()) { switch (it.next()){ case "X": System.out.print("X "); break; case "Y": System.out.print("Y "); break; } count++; } System.out.println ("\ncount = " + count); } } What is the result?
Options
- AX X Y X Y
- BX Y X Y
- CX Y
- DX Y
Unlock 1Z0-805 to see the answer
You've previewed enough free 1Z0-805 questions. Unlock 1Z0-805 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.