Become Oracle Certified with updated 1Z0-809 exam questions and correct answers
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!?
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?
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.)
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. }
Given the content of Operator.java, EngineOperator.java, and Engine.java files:
© 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.