Free 1Z0-809 Exam Questions - Easiest Way for Success

Prepare for the Oracle 1Z0-809 exam questions with our authentic preparation materials, including free 1Z0-809 practice exam questions and answers. TheExamsLab provides all the support you need to succeed in the Java SE 8 Programmer II 1Z0-809 exam. This dedication to student success is why we have the most satisfied 1Z0-809 certification exam candidates worldwide.

Page:    1 / 94      
Total 469 Questions | Updated On: Sep 13, 2024
Add To Cart
Question 1

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

1. package com.udayan.ocp;

2.  

3. class X {

4.     class Y {

5.         private void m() {

6.             System.out.println("INNER");

7.         }

8.     }

9.     

10.     public void invokeInner() {

11.         Y obj = new Y(); //Line 9

12.         obj.m(); //Line 10

13.     }

14. }

15.  

16. public class Test {

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

18.         new X().invokeInner();

19.     }

20. }


Answer: C
Question 2

F: is accessible for reading and below is the directory structure for F:

1. F:.

2. └───A

3.     └───B

4.         └───C

5.                 Book.java

'Book.java' file is available under 'C' directory.

Given code of Test.java file: 

1. package com.udayan.ocp;

2.  

3. import java.nio.file.Path;

4. import java.nio.file.Paths;

5.  

6. public class Test {

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

8.         Path file = Paths.get("F:\\A\\B\\Book.java");

9.         System.out.println(file.toAbsolutePath());

10.     }

11. }

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


Answer: A
Question 3

Given code of Test.java file:

1. package com.udayan.ocp;

2.  

3. interface Printer1 {

4.     default void print() {

5.         System.out.println("Printer1");

6.     }

7. }

8.  

9. class Printer2 {

10.     public void print() {

11.         System.out.println("Printer2");

12.     }

13. }

14.  

15. class Printer extends Printer2 implements Printer1 {

16.  

17. }

18.  

19. public class Test {

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

21.         Printer printer = new Printer();

22.         printer.print();

23.     }

24. }

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


Answer: D
Question 4

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?


Answer: A
Question 5

Given code of Test.java file: 

1. package com.udayan.ocp;

2.  

3. public class Test {

4.     private static void m1() throws Exception {

5.         throw new Exception();

6.     }

7.  

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

9.         try {

10.             m1();

11.         } finally {

12.             System.out.println("A");

13.         }

14.     }

15. }

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


Answer: D
Page:    1 / 94      
Total 469 Questions | Updated On: Sep 13, 2024
Add To Cart

© Copyrights TheExamsLab 2024. All Rights Reserved

We use cookies to ensure your best experience. So we hope you are happy to receive all cookies on the TheExamsLab.