Question: Which is one of the lines output by this code? A. [] B. [8, 10] C. [8, 9, 10] D. [10, 8] E. The code

Which is one of the lines output by this code? 

10: var list= new ArrayList (); 11: list.add (10); 12: list.add (9);

A. [] 

B. [8, 10] 

C. [8, 9, 10] 

D. [10, 8] 

E. The code does not compile.

10: var list= new ArrayList (); 11: list.add (10); 12: list.add (9); 13: list.add(8); 14: 15: var num = 9; 16: list.removeIf (x -> {int keep = num; return x != keep;}); 17: System.out.println(list); 18: 19: list.removeIf (x -> {int keep = num; return x == keep; }); 20 System.out.println (list);

Step by Step Solution

3.41 Rating (154 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The provided image contains Java code designed to perform operations on an ArrayList of Integer call... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Oracle Questions!