Oracle 1Z0-829

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

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 2

Question ID: UK8295506
Given code of Test.java file:
package com.examtest.ocp;
 
public class Test {
    public static void main(String[] args) {
        String[] arr = { "L", "I", "V", "E" }; //Line n1
        int i = -2;
 
        if (i++ == -1) { //Line n2
            arr[-(--i)] = "F"; //Line n3
        } else if (--i == -2) { //Line n4
            arr[-++i] = "O"; //Line n5
        }
 
        System.out.println(String.join("", arr)); //Line n6
    }
}
What is the result?


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: UK8297789
Given code of Test.java file:
package com.examtest.ocp;
 
import java.util.ArrayList;
import java.util.List;
 
public class Test {
    public static void main(String[] args) {
        Boolean [] arr = new Boolean[2];
        List<Boolean> list = new ArrayList<>();
        list.add(arr[0]);
        list.add(arr[1]);
        
        if(list.remove(0)) {
            list.remove(1);
        }
        
        System.out.println(list);
    }
}
What is the result?


Answer: C
Question 5

Given the course table:



Given the code fragment:


 


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