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. public class Test {

4.     private static void div(int i, int j) {

5.         try {

6.             System.out.println(i / j);

7.         } catch(ArithmeticException e) {

8.             throw (RuntimeException)e;

9.         }

10.     }

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

12.         try {

13.             div(5, 0);

14.         } catch(ArithmeticException e) {

15.             System.out.println("AE");

16.         } catch(RuntimeException e) {

17.             System.out.println("RE");

18.         }

19.     }

20. }

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

Options :
Answer: A

Question 2

Given the code fragments:

Untitled1-page69-image83
and
Untitled1-page69-image88
What is the result?

Options :
Answer: D

Question 3

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 4

Given the code fragment:
Stream<Path> files = Files.list(Paths.get(System.getProperty(“user.home”)));
 files.forEach (fName -> { //line n1
 try {
 Path aPath = fName.toAbsolutePath(); //line n2
 System.out.println(fName + “:”
 + Files.readAttributes(aPath,
Basic.File.Attributes.class).creationTime
());
 } catch (IOException ex) {
 ex.printStackTrace();
 });
What is the result?

Options :
Answer: C

Question 5

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

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