Exam Code: 1Z0-809
Exam Questions: 469
Java SE 8 Programmer II
Updated: 24 Nov, 2025
Viewing Page : 1 - 47
Practicing : 1 - 5 of 469 Questions
Question 1

Given the code fragment:Untitled1-page69-image50You have been asked to define the ProductCode class. The definition of the ProductCode class mustallow c1 instantiation to succeed and cause a compilation error on c2 instantiation.Which definition of ProductCode meets the requirement?

Options :
Answer: B

Question 2

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 3

Given the code fragment:Path p1 = Paths.get(“/Pics/MyPic.jpeg”);System.out.println (p1.getNameCount() + “:” + p1.getName(1) + “:” + p1.getFileName());Assume that the Pics directory does NOT exist.What is the result?

Options :
Answer: B

Question 4

Given code of Test.java file: 1. package com.udayan.ocp;2.  3. import java.time.*;4.  5. public class Test {6.     public static void main(String [] args) {7.         System.out.println(Duration.ofDays(-2));8.     }9. }What will be the result of compiling and executing Test class?

Options :
Answer: D

Question 5

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

Viewing Page : 1 - 47
Practicing : 1 - 5 of 469 Questions

© Copyrights FreePDFQuestions 2025. All Rights Reserved

We use cookies to ensure that we give you the best experience on our website (FreePDFQuestions). If you continue without changing your settings, we'll assume that you are happy to receive all cookies on the FreePDFQuestions.