EXPERTY DESIGNED 1Z0-809 PRACTICE TEST

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

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 2

Given the code fragment:

Untitled1-page69-image118
Assume that:
 The required database driver is configured in the classpath.
 The appropriate database is accessible with the dbURL, userName, and passWord exists.
 The Employee and Customer tables are available and each table has id column with a few records and
the SQL queries are valid.
What is the result of compiling and executing this code fragment?

Options :
Answer: C

Question 3

Consider the code of Greet.java file:

1. package com.udayan.ocp;

2.  

3. public final class Greet {

4.     private String msg;

5.     public Greet(String msg) {

6.         this.msg = msg;

7.     }

8.  

9.     public String getMsg() {

10.         return msg;

11.     }

12.  

13.     public void setMsg(String msg) {

14.         this.msg = msg;

15.     }

16. }

Is Greet class an immutable class?

Options :
Answer: B

Question 4

Given:
class UserException extends Exception { }
class AgeOutOfLimitException extends UserException { }
and the code fragment:
class App {
 public void doRegister(String name, int age)
 throws UserException, AgeOutOfLimitException {
 if (name.length () < 6) {
 throw new UserException ();
 } else if (age >= 60) {
 throw new AgeOutOfLimitException ();
 } else {
 System.out.println(“User is registered.”);
 }
 }
 public static void main(String[ ] args) throws UserException {
 App t = new App ();
 t.doRegister(“Mathew”, 60);
 }
}
What is the result?

Options :
Answer: B

Question 5

Given:

Untitled1-page69-image37
and the code fragment:
Untitled1-page69-image36
Which two code fragments, when inserted at line n1 independently, enable the code to print
TruckCarBike?

Options :
Answer: A,D

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