Which code fragment must be inserted at line n1 to enable the code to print the maximum number in the nums list?

Given the code fragment:
List<Integer> nums = Arrays.asList (10, 20, 8):
System.out.println (
//line n1
);
Which code fragment must be inserted at line n1 to enable the code to print the maximum number in the nums list?
A. nums.stream().max(Comparator.comparing(a -> a)).get()
B. nums.stream().max(Integer : : max).get()
C. nums.stream().max()
D. nums.stream().map(a -> a).max()

Download Printable PDF. VALID exam to help you PASS.

4 thoughts on “Which code fragment must be inserted at line n1 to enable the code to print the maximum number in the nums list?

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.