What is the output of the following code segments? //ArrayList a contains the In
ID: 3610427 • Letter: W
Question
What is the output of the following code segments? //ArrayList a contains the Integers: 5 9 4 39 Set<Integer> t = newTreeSet<Integer>(a); Iterator<Integer> i =t.iterator(); while(i.hasNext()) 7. System.out.print(i.next() + ""); System.out.println(); Set<Integer> h = newHashSet<Integer>(a); i = h.iterator(); while(i.hasNext()); 8. System.out.print(i.next()+ " "); 9. System.out.println(t); 10.System.out.println(h); 11.System.out.println(a); 7.____________ 8.____________ 9.____________ 10.___________ 11.___________ What is the output of the following code segments? //ArrayList a contains the Integers: 5 9 4 39 Set<Integer> t = newTreeSet<Integer>(a); Iterator<Integer> i =t.iterator(); while(i.hasNext()) 7. System.out.print(i.next() + ""); System.out.println(); Set<Integer> h = newHashSet<Integer>(a); i = h.iterator(); while(i.hasNext()); 8. System.out.print(i.next()+ " "); 9. System.out.println(t); 10.System.out.println(h); 11.System.out.println(a); 7.____________ 8.____________ 9.____________ 10.___________ 11.___________ 10.___________ 11.___________Explanation / Answer
Dear,
//ArrayList a contains the Integers: 59 4 3 9
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.