Oracle
1Z0-819 · Question #132
1Z0-819 Question #132: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-819 to reveal the answer and full explanation for question #132. The question stem and answer options stay visible for context.
Question
Given: package p1;
public class Person {
protected Person() {
} //line 1
}
and
package a;
import b.Person;
public class Main {
//line 2
public static void main(String[] args) {
Person person = new Person(); //line 3
}
}
Which two allow to allocate a new Person? (Choose two.)
Options
- AIn Line 1, change the access modifier to private:private Person() {
- BIn Line 1, change the access modifier to public:public Person() {
- CIn Line 2, add extend Person to the Main class:public class Main extends Person { and change Line 3 to create a new Main object:Person person = new Main();
- DIn Line 2, change the access modifier to public:public class Main {
- EIn Line 1, remove the access modifier:Person() {
Unlock 1Z0-819 to see the answer
You've previewed enough free 1Z0-819 questions. Unlock 1Z0-819 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.