×

Special Offer! 20% OFF on All Certification Exam Questions - Ends In Coupon code: TEL20

Free Practice Oracle 1Z0-808 Exam Questions 2025

Stay ahead with 100% Free Java SE 8 Programmer I 1Z0-808 Dumps Practice Questions

Page:    1 / 122      
Total 608 Questions | Updated On: Feb 19, 2025
Add To Cart
Question 1

Consider below codes of 3 java files:

1. //M.java

2. package com.sampleproject.oca;

3.  

4. public class M {

5.     public void printName() {

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

7.     }

8. }

1. //N.java

2. package com.sampleproject.oca;

3.  

4. public class N extends M {

5.     public void printName() {

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

7.     }

8. }

1. //Test.java

2. package com.sampleproject.oca.test;

3.  

4. import com.sampleproject.oca.*;

5.  

6. public class Test {

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

8.         M obj1 = new M();

9.         N obj2 = (N)obj1;

10.         obj2.printName();

11.     }

12. }

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


Answer: C
Question 2

Consider below code of Test.java file:

1. package com.sampleproject.oca;

2.  

3. class Super {

4.     public String num = "10"; //Line n1

5. }

6.  

7. class Sub extends Super {

8.     protected int num = 20; //Line n2

9. }

10.  

11. public class Test {

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

13.         Super obj = new Sub();

14.         System.out.println(obj.num += 2); //Line n3

15.     }

16. }

What will be the result of compiling and executing above code?


Answer: F
Question 3

Given:

1Z0-808
What is the result?


Answer: B
Question 4

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

1. package com.udayan.oca;

2.  

3. public class Test {

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

5.          int x = 1;

6.          while(checkAndIncrement(x)) {

7.              System.out.println(x);

8.          }

9.      }

10.  

11.      private static boolean checkAndIncrement(int x) {

12.          if(x < 5) {

13.              x++;

14.              return true;

15.          } else {

16.              return false;

17.          }

18.      }

19. }


Answer: C
Question 5

Below is the code of Test.java file:

1. package com.udayan.oca;

2.  

3. import java.util.ArrayList;

4. import java.util.List;

5.  

6. public class Test {

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

8.          List list = new ArrayList();

9.  

10.          list.add(27);

11.          list.add(27);

12.  

13.          list.add(new Integer(27));

14.          list.add(new Integer(27));

15.  

16.          System.out.println(list.get(0) == list.get(1));

17.          System.out.println(list.get(2) == list.get(3));

18.      }

19. }

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


Answer: C
Page:    1 / 122      
Total 608 Questions | Updated On: Feb 19, 2025
Add To Cart

© Copyrights TheExamsLab 2025. All Rights Reserved

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