EXPERTY DESIGNED 1Z0-829 PRACTICE TEST

Oracle 1Z0-829 Exam Questions
Total Questions: 660
Java SE 17 Developer
Updated On: Dec 07, 2025
Page : 1-66
Question 1

Question ID: UK8292005
Given code of Test.java file:
package com.examtest.ocp;
 
public class Test<T> {
    private T t;
 
    public T get() {
        return t;
    }
 
    public void set(T t) {
        this.t = t;
    }
 
    public static void main(String args[]) {
        Test obj = new Test();
        obj.set("OCP");
        obj.set(85);
        obj.set('%');
 
        System.out.println(obj.get());
    }
}
What is the result?

Options :
Answer: D

Question 2

Question ID: UK8297735
Given code of Test.java file:
package com.examtest.ocp;
 
public class Test {
    enum TrafficLight {
        private String message;
        GREEN("go"), AMBER("slow"), RED("stop");
        
        TrafficLight(String message) {
            this.message = message;
        }
        
        public String getMessage() {
            return message;
        }
    }
    
    public static void main(String[] args) {
        System.out.println(TrafficLight.AMBER.getMessage().toUpperCase());
    }
What is the result?

Options :
Answer: C

Question 3

Question ID: UK8298570
Consider below code of Test.java file:
package com.examtest.ocp; 
 
public class Test extends String {
    @Override
    public String toString() {
        return "TEST";
    }
    
    public static void main(String[] args) {
        Test obj = new Test();
        System.out.println(obj);
    }
}
What is the result?

Options :
Answer: D

Question 4

Question ID: UK8296869
Given code of Test.java file:
package com.examtest.ocp;
 
class Parent {
    int var = 1000; // Line n1
 
    int getVar() {
        return var;
    }
}
 
class Child extends Parent {
    private int var = 2000; // Line n2
 
    int getVar() {
        return super.var; //Line n3
    }
}
 
public class Test {
    public static void main(String[] args) {
        Child obj = new Child(); // Line n4
        System.out.println(obj.var); // Line n5
    }
}
There is a compilation error in the code.
Which three modifications, done independently, print 1000 on to the console?

Options :
Answer: A,B,D

Question 5

Question ID: UK8291153
Given 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<Person> 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

© Copyrights Oracledumps 2025. 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.