EXPERTY DESIGNED 1Z0-809 PRACTICE TEST

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

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 2

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

1. package com.udayan.ocp;

2.  

3. class M {

4.     private int num1 = 100;

5.     class N {

6.         private int num2 = 200;

7.     }

8.     

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

10.         M outer = new M();

11.         M.N inner = outer.new N();

12.         System.out.println(outer.num1 + inner.num2);

13.     }

14. }

Options :
Answer: A

Question 3

Given:
class FuelNotAvailException extends Exception { }
class Vehicle {
 void ride() throws FuelNotAvailException { //line n1
 System.out.println(“Happy Journey!”);
 }
}
class SolarVehicle extends Vehicle {
 public void ride () throws Exception { //line n2
 super ride ();
 }
}
and the code fragment:
public static void main (String[] args) throws FuelNotAvailException, Exception
 {
 Vehicle v = new SolarVehicle ();
 v.ride();
}
Which modification enables the code fragment to print Happy Journey!?

Options :
Answer: B

Question 4

Below is the code of Test.java file:

1. package com.udayan.ocp;

2.  

3. class Outer {

4.     static class Inner {

5.         static void greetings(String s) {

6.             System.out.println(s);

7.         }

8.     }

9. }

10.  

11. public class Test {

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

13.         /*INSERT*/

14.     }

15. }

Which of the following 2 options can replace /*INSERT*/ such that there on executing class Test, output is: HELLO!?

Options :
Answer: A,C

Question 5

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

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