EXPERTY DESIGNED 1Z0-809 PRACTICE TEST

Oracle 1Z0-809 Exam Questions
Total Questions: 469
Java SE 8 Programmer II
Updated On: Dec 07, 2025
Page : 1-47
Question 1

Given code of Test.java file:

1. package com.udayan.ocp;

2.  

3. interface Printer1 {

4.     default void print() {

5.         System.out.println("Printer1");

6.     }

7. }

8.  

9. class Printer2 {

10.     public void print() {

11.         System.out.println("Printer2");

12.     }

13. }

14.  

15. class Printer extends Printer2 implements Printer1 {

16.  

17. }

18.  

19. public class Test {

20.     public static void main(String[] args) {

21.         Printer printer = new Printer();

22.         printer.print();

23.     }

24. }

What will be the result of compiling and executing Test class?

Options :
Answer: D

Question 2

Given code of Test.java file: 

1. package com.udayan.ocp;

2.  

3. import java.util.stream.Stream;

4.  

5. public class Test {

6.     public static void main(String[] args) {

7.         System.out.println(Stream.of(10, 0, -10).sorted().findAny().orElse(-1));

8.     }

9. }

Which of the following statements are true about the execution of Test class?

Select 2 options.

Options :
Answer: A,B

Question 3

The last statement inside main(String []) method, increments value of i, which means it is not effectively final and hence compilation error.

//Test.java

package com.udayan.ocp;

 

class Player {

    String name;

    int age;

    Player() {

        this.name = "Virat";

        this.age = 29;

    }

    

    public int hashCode() {

        return 100;

    }

}

 

public class Test {

    public static void main(String[] args) {

        System.out.println(new Player());

    }

}

Hexadecimal representation of 100 is 64.

Which of the following option is correct?

Options :
Answer: B

Question 4

Given code of Test.java file: 

1. package com.udayan.ocp;

2.  

3. import java.util.stream.Stream;

4.  

5. public class Test {

6.     public static void main(String[] args) {

7.         Stream stream = Stream.of("d", "cc", "bbb", "aaaa");

8.         stream.sorted().forEach(System.out::println);

9.     }

10. }

Which of the following needs to be done, so that output is: 

d

cc

bbb

aaaa

Options :
Answer: B

Question 5

Given the code fragment:
List<String> empDetails = Arrays.asList(“100, Robin, HR”,
 “200, Mary, AdminServices”,
 “101, Peter, HR”);
empDetails.stream()
 .filter(s-> s.contains(“1”))
 .sorted()
 .forEach(System.out::println); //line n1
What is the result?

Options :
Answer: A

© 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.