Become Oracle Certified with updated 1Z0-809 exam questions and correct answers
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. }
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?
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?
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. }
Given the code fragment:

© Copyrights DumpsCertify 2025. All Rights Reserved
We use cookies to ensure your best experience. So we hope you are happy to receive all cookies on the DumpsCertify.