How many lines does this code output?
List<String> list = new LinkedList<>(); list.add("A"); list.add("B"); Stream<String> s = list.stream(); s.forEach(System.out::println); s.forEach(System.out::println);
D.
Java only allows you to operate on a stream once.
The final line of code throws an IllegalStateException because the stream has already been used up.
Option D is the correct answer.