Question: How many lines does this code output? A. One. B. Two. C. Three. D. None. It doesnt compile. E. None. It throws an exception at
How many lines does this code output?
![import java.util.*; public class PrintNegative { public static void main(String[] args) {](https://dsd5zvtm8ll6.cloudfront.net/images/question_images/1707/5/7/6/04765c78aef1ead41707576046845.jpg)
A. One.
B. Two.
C. Three.
D. None. It doesn’t compile.
E. None. It throws an exception at runtime.
import java.util.*; public class PrintNegative { public static void main(String[] args) { List list = new ArrayList (); list.add(-5); } } list.add(0); list.add(5); list.removeIf (e -> e < 0); list.forEach(x -> System.out.println(x));
Step by Step Solution
3.44 Rating (173 Votes )
There are 3 Steps involved in it
ANSWER The provided Java code creates an ArrayList adds three integers to it removes any ele... View full answer
Get step-by-step solutions from verified subject matter experts
