Since budget is a member variable declared in the Manager class (subclass), instances of the Employee class (superclass) cannot directly access or modify the budget variable.
And stockOption does not exit.
Answer is CE.
To test:
class Employee {
public int salary;
}
class Manager extends Employee {
public int budget;
}
public class Director extends Manager {
public int stockOptions;
public static void main (String [] args ) {
Employee employee = new Employee();
Manager manager = new Manager();
Director director = new Director();
employee.salary = 50_000; // A
director.salary = 80_000; // B
// employee.budget = 200_000; // C
manager.budget = 1_000_000; // D
// manager.stockOption = 500; // E
director.stockOptions = 1_000; // F
System.out.println(employee.salary);
System.out.println(director.salary);
// System.out.println(stockOptions);
System.out.println(manager.budget);
// System.out.println(manager.stockOption);
System.out.println(director.stockOptions);
}
}
We cannot access variable budget by the object of employee and variable stockOptions by the object of manager as they lie in the child branch. Thus C and E are correct.
This question is not written correctly, the actual questions references all the objects using the Employee class
upvoted 1 times
...
This section is not available anymore. Please use the main Exam Page.1z0-808 Exam Questions
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
DarGrin
8 months, 3 weeks agoManuTov
10 months, 1 week agoVicky_65
1 year, 2 months agocarloswork
1 year, 7 months agokkaayyyy
1 year, 8 months agoshivkumarx
1 year, 9 months ago