Given code of Test.java file:
1. package com.udayan.ocp;
2.
3. import java.util.Arrays;
4. import java.util.List;
5. import java.util.ListIterator;
6.
7. public class Test {
8. public static void main(String[] args) {
9. List
10. ListIterator
11. while(iter.hasNext()) {
12. System.out.print(iter.next());
13. }
14. }
15. }
What will be the result of compiling and executing Test class?
Given code of Test.java file:
1. package com.udayan.ocp;
2.
3. import java.util.Arrays;
4. import java.util.Comparator;
5. import java.util.List;
6.
7. public class Test {
8. public static void main(String[] args) {
9. List
10.
11. System.out.println(list.stream().max(Comparator.comparing(a -> a)).get()); //Line 1
12.
13. System.out.println(list.stream().max(Integer::compareTo).get()); //Line 2
14.
15. System.out.println(list.stream().max(Integer::max).get()); //Line 3
16. }
17. }
Which of the following statement is true?
Given code of Test.java file:
1. package com.udayan.ocp;
2.
3. import java.time.*;
4.
5. public class Test {
6. public static void main(String [] args) {
7. System.out.println(Duration.ofDays(-2));
8. }
9. }
What will be the result of compiling and executing Test class?
© Copyrights Oracledumps 2025. All Rights Reserved
We use cookies to ensure that we give you the best experience on our website (Oracledumps). If you continue without changing your settings, we'll assume that you are happy to receive all cookies on the Oracledumps.