Assess the CertsIQ’s updated 1Z0-809 exam questions for free online practice of your Java SE 8 Programmer II test. Our 1Z0 809 dumps questions will enhance your chances of passing the Oracle Java certification exam with higher marks.
Consider the code of Greet.java file:
1. package com.udayan.ocp;
2.
3. public final class Greet {
4. private String msg;
5. public Greet(String msg) {
6. this.msg = msg;
7. }
8.
9. public String getMsg() {
10. return msg;
11. }
12.
13. public void setMsg(String msg) {
14. this.msg = msg;
15. }
16. }
Is Greet class an immutable class?
Given code of Test.java file:
1. package com.udayan.ocp;
2.
3. public class Test {
4. private static String msg = "Hello";
5.
6. private static String changeMsg(String m) {
7. msg = m;
8. return null;
9. }
10.
11. public static void main(String[] args) {
12. if(args.length == 0) {
13. assert false : changeMsg("Bye");
14. }
15. System.out.println(msg);
16. }
17. }
What will be the result of executing Test class with below command?
java -ea com.udayan.ocp.Test
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. }
Consider the code of Test.java file:
1. package com.udayan.ocp;
2.
3. class Player {
4. String name;
5. int age;
6.
7. Player() {
8. this.name = "Yuvraj";
9. this.age = 36;
10. }
11.
12. public String toString() {
13. return name + ", " + age;
14. }
15.
16. public Class getClass() {
17. return super.getClass();
18. }
19. }
20.
21. public class Test {
22. public static void main(String[] args) {
23. System.out.println(new Player());
24. }
25. }
What will be the result of compiling and executing Test class?
Given code of Test.java file:
1. package com.udayan.ocp;
2.
3. import java.util.Arrays;
4. import java.util.List;
5. import java.util.ListIterator;
6.
7. public class Test {
8. public static void main(String[] args) {
9. List
10. ListIterator
11. while(iter.hasNext()) {
12. System.out.print(iter.next());
13. }
14. }
15. }
What will be the result of compiling and executing Test class?
© Copyrights CertsIQ 2025. All Rights Reserved
We use cookies to ensure that we give you the best experience on our website (CertsIQ). If you continue without changing your settings, we'll assume that you are happy to receive all cookies on the CertsIQ.