What is the output of the following code segments? Set<Integer> s = newTreeSet<I
ID: 3610426 • Letter: W
Question
What is the output of the following code segments? Set<Integer> s = newTreeSet<Integer>(); s.add(3); 4.System.out.println(s.add(7)); s.add(new Integer(9)); 5.System.out.println(s.add(new Integer(3))); for(int i : s) //newenhanced for loop 6. System.out.print(i); 4.____________ 5.____________ 6.____________ What is the output of the following code segments? Set<Integer> s = newTreeSet<Integer>(); s.add(3); 4.System.out.println(s.add(7)); s.add(new Integer(9)); 5.System.out.println(s.add(new Integer(3))); for(int i : s) //newenhanced for loop 6. System.out.print(i); 4.____________ 5.____________ 6.____________Explanation / Answer
Dear,
TreeSet - stores objects in a linear sequence, sorted by acomparison, with no duplicates
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.