EXPERTY DESIGNED 1Z0-809 PRACTICE TEST

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

Consider the code of Test.java file:

1. package com.udayan.ocp;

2.  

3. class Player {

4.     String name;

5.     int age;

6.  

7.     Player() {

8.         this.name = "Yuvraj";

9.         this.age = 36;

10.     }

11.  

12.     public String toString() {

13.         return name + ", " + age;

14.     }

15.     

16.     public Class getClass() { 

17.         return super.getClass();

18.     }

19. }

20.  

21. public class Test {

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

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

24.     }

25. }

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

Options :
Answer: A

Question 2

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

1. package com.udayan.ocp;

2.  

3. class X {

4.     class Y {

5.         private void m() {

6.             System.out.println("INNER");

7.         }

8.     }

9.     

10.     public void invokeInner() {

11.         Y obj = new Y(); //Line 9

12.         obj.m(); //Line 10

13.     }

14. }

15.  

16. public class Test {

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

18.         new X().invokeInner();

19.     }

20. }

Options :
Answer: C

Question 3

Given code of Test.java file: 

1. package com.udayan.ocp;

2.  

3. import java.util.ArrayDeque;

4. import java.util.Deque;

5.  

6. public class Test {

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

8.         Deque deque = new ArrayDeque<>();

9.         deque.push(new Boolean("abc"));

10.         deque.push(new Boolean("tRuE"));

11.         deque.push(new Boolean("FALSE"));

12.         deque.push(true);

13.         System.out.println(deque.pop() + ":" + deque.peek() + ":" + deque.size());

14.     }

15. }

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

Options :
Answer: A

Question 4

Given the code fragments:
class MyThread implements Runnable {
 private static AtomicInteger count = new AtomicInteger (0);
 public void run () {
 int x = count.incrementAndGet();
 System.out.print (x+” “);
 }
}
and
Thread thread1 = new Thread(new MyThread());
Thread thread2 = new Thread(new MyThread());
Thread thread3 = new Thread(new MyThread());
Thread [] ta = {thread1, thread2, thread3};
for (int x= 0; x < 3; x++) {
 ta[x].start();
}
Which statement is true?

Options :
Answer: A

Question 5

Given code of Test.java file:

package com.udayan.ocp;

 

import java.util.Arrays;

import java.util.List;

 

public class Test {

    public static void main(String[] args) {

        List list = Arrays.asList("A", "E", "I", "O");

        list.add("U");

        list.forEach(System.out::print);

    }

}

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

Options :
Answer: B

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