EXPERTY DESIGNED 1Z0-809 PRACTICE TEST

Oracle 1Z0-809 Exam Questions
Total Questions: 469
Java SE 8 Programmer II
Updated On: Dec 18, 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

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 3

You want to create a singleton class by using the Singleton design pattern. Which two statements enforce the singleton nature of the design? (Choose two.)

Options :
Answer: A,B

Question 4

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

Question 5

Given the code fragment:
public class FileThread implements Runnable {
 String fName;
 public FileThread(String fName) { this.fName = fName; }
 public void run () System.out.println(fName);}
 public static void main (String[] args) throws IOException,
InterruptedException {
 ExecutorService executor = Executors.newCachedThreadPool();
 Stream<Path> listOfFiles = Files.walk(Paths.get(“Java Projects”));
 listOfFiles.forEach(line -> {
 executor.execute(new FileThread(line.getFileName().toString()));
 //
line n1
 });
 executor.shutdown();
 executor.awaitTermination(5, TimeUnit.DAYS); //
line n2
 }
}
The Java Projects directory exists and contains a list of files.
What is the result?

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.