Oracle
1Z0-819 · Question #175
1Z0-819 Question #175: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-819 to reveal the answer and full explanation for question #175. The question stem and answer options stay visible for context.
Question
Which of the following produces the same result as the given for loop?
for (int i = 1; i < 10; ++i) {
System.out.println(i);
}
Options
- AStream<Integer> nums1 = Stream.iterate(1, n -> n < 10, n + 2); forEach(System.out.println);
- BStream<Integer> nums2 = Stream.iterate(1, n -> n < 10, n + 1); forEach(System.out.println(n));
- CStream<Integer> nums3 = Stream.iterate(1, n -> n < 10, n + 1); forEach(System.out.println);
- DStream.iterate(1, n -> n < 10, n + 1).forEach(System.out.println);
Unlock 1Z0-819 to see the answer
You've previewed enough free 1Z0-819 questions. Unlock 1Z0-819 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.