EXPERTY DESIGNED 1Z0-808 PRACTICE TEST

Oracle 1Z0-808 Exam Questions
Total Questions: 608
Java SE 8 Programmer I
Updated On: Jan 04, 2026
Page : 1-61
Question 1

Given code of Test.java file:

1. package com.sampleproject.oca;

2.  

3. interface Blogger {

4.     default void blog() throws Exception {

5.         System.out.println("GENERIC");

6.     }

7. }

8.  

9. class TravelBlogger implements Blogger {

10.     public void blog() {

11.         System.out.println("TRAVEL");

12.     }

13. }

14.  

15. public class Test {

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

17.         Blogger blogger = new TravelBlogger(); //Line n1

18.         ((TravelBlogger)blogger).blog(); //Line n2

19.     }

20. }

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

Options :
Answer: B

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?

Options :
Answer: F

Question 3

Given code of Test.java file:

1. package com.sampleproject.oca;

2.  

3. public class Test {

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

5.         try { //outer

6.             try { //inner

7.                 System.out.println(1/0);

8.             } catch(ArithmeticException e) {

9.                 System.out.println("INNER");

10.             } finally {

11.                 System.out.println("FINALLY 1");

12.             }

13.         } catch(ArithmeticException e) {

14.             System.out.println("OUTER");

15.         } finally {

16.             System.out.println("FINALLY 2");

17.         }

18.     }

19. }

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

Options :
Answer: D

Question 4

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

package com.udayan.oca;

 

public class Test {

     public static void main(String[] args) {

         String str1 = " ";

         boolean b1 = str1.isEmpty();

         System.out.println(b1);

         str1.trim();

         b1 = str1.isEmpty();

         System.out.println(b1);

     }

}

Options :
Answer: A

Question 5

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?

Options :
Answer: C

© Copyrights Oracledumps 2026. All Rights Reserved

We use cookies to ensure that we give you the best experience on our website (Oracledumps). If you continue without changing your settings, we'll assume that you are happy to receive all cookies on the Oracledumps.