Exam Code: 1Z0-829
Exam Questions: 660
Java SE 17 Developer
Updated: 14 Apr, 2026
Viewing Page : 1 - 66
Practicing : 1 - 5 of 660 Questions
Question 1

Question ID: UK8291153Given code of Test.java file:package com.examtest.ocp; import java.util.ArrayList;import java.util.List; class Person {    private String name;    private int age;        Person(String name, int age) {        this.name = name;        this.age = age;    }        public String toString() {        return "Person[" + name + ", " + age + "]";    }        public boolean equals(Person obj) {        if(obj instanceof Person) {            Person person = (Person)obj;            if(this.name.equals(person.name) && this.age == person.age) {                return true;            }        }        return false;    }} public class Test {    public static void main(String[] args) {        List persons = new ArrayList<>();        persons.add(new Person("Liam", 25));        persons.add(new Person("Liam", 27));        persons.add(new Person("Liam", 25));        persons.add(new Person("Liam", 25));                persons.remove(new Person("Liam", 25));                for(Person person : persons) {            System.out.println(person);        }    }}What is the result?

Options :
Answer: D

Question 2

Question ID: UK8297257Given code of Test.java file:package com.examtest.ocp; public class Test {    public static void main(String[] args) {        int x = 2;        switch (x) {            default:                System.out.println("Still no idea what x is");            case 1:                System.out.println("x is equal to 1");                break;            case 2:                System.out.println("x is equal to 2");                break;            case 3:                 System.out.println("x is equal to 3");                break;        }    }}What is the result?

Options :
Answer: A

Question 3

Question ID: UK8291924Given code of Test.java file:package com.examtest.ocp; import java.time.*; public class Test {    public static void main(String [] args) {        Period period = Period.ofWeeks(100);        System.out.println(period);    }}What is the result?

Options :
Answer: C

Question 4

Question ID: UK8297789Given 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 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?

Options :
Answer: C

Question 5

Given the directory structure:Given the definition of the Doc class:Which two are valid definition of the wordDoc class?

Options :
Answer: A,E

Viewing Page : 1 - 66
Practicing : 1 - 5 of 660 Questions

© Copyrights FreePDFQuestions 2026. All Rights Reserved

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