Special Offer! Limited-Time Offer! Get 25% Off on All Certification Exams – Prepare & Pass with Confidence! Use Code: DC25OFF
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?
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?
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?
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!?
© Copyrights Dumpscity 2025. All Rights Reserved
We use cookies to ensure your best experience. So we hope you are happy to receive all cookies on the Dumpscity.