Oracle 1Z0-829

Page:    1 / 132   
Total 660 questions | Updated On: Apr 22, 2024
Question 1

Given the course table:



Given the code fragment:


 


Answer: C
Question 2

Question ID: UK8295518
How many of the below code statements, written inside main method will compile successfully?
1. var arr1 = new int[]{10};
2. var arr2 = new String[][] {};
3. var arr3 = new char[][] {{}};
4. var arr4 = {10, 20, 30};
5. var arr5 = new String[][] {new String[]{"LOOK"}, new String[] {"UP"}};
6. var [] arr6 = new int[] {2, 3, 4};


Answer: A
Question 3

Question ID: UK8293780
Given code of Test.java file:
package com.examtest.ocp;
 
interface Blogger {
    default void blog() throws Exception {
        System.out.println("GENERIC");
    }
}
 
class TravelBlogger implements Blogger {
    public void blog() {
        System.out.println("TRAVEL");
    }
}
 
public class Test {
    public static void main(String[] args) {
        Blogger blogger = new TravelBlogger(); //Line n1
        ((TravelBlogger)blogger).blog(); //Line n2
    }
}
What is the result?


Answer: D
Question 4

Question ID: UK8295913
Given code of Test.java file:
package com.examtest.ocp;
 
record Rectangle(double length, double width) {}
 
record Square(double side) extends Rectangle {}
 
public class Test {
    public static void main(String[] args) {
        Square sq = new Square(10.0);
        System.out.println(sq);
    }
}
What is the result?


Answer: A
Question 5

Question ID: UK8292454
Given code of Test.java file:
package com.examtest.ocp;
 
public class Test {
    private static void div(int i, int j) {
        try {
            System.out.println(i / j);
        } catch(ArithmeticException e) {
            throw (RuntimeException)e;
        }
    }
    
    public static void main(String[] args) {
        try {
            div(5, 0);
        } catch(ArithmeticException e) {
            System.out.println("AE");
        } catch(RuntimeException e) {
            System.out.println("RE");
        }
    }
}
What is the result?


Answer: C
Page:    1 / 132   
Total 660 questions | Updated On: Apr 22, 2024

Quickly grab our 1Z0-829 product now and kickstart your exam preparation today!

Name: Java SE 17 Developer
Exam Code: 1Z0-829
Certification: Oracle Java
Vendor: Oracle
Total Questions: 660
Last Updated: Apr 22, 2024