nerdexam
Oracle

1Z0-808 · Question #35

Given the following classes: public class Employee { public int salary; } public class Manager extends Employee { public int budget; } public class Director extends Manager { public int stockOptions;

Sign in or unlock 1Z0-808 to reveal the answer and full explanation for question #35. The question stem and answer options stay visible for context.

Java Class Design

Question

Given the following classes: public class Employee { public int salary; } public class Manager extends Employee { public int budget; } public class Director extends Manager { public int stockOptions; } And given the following main method: public static void main(String[] args) { Employee employee = new Employee(); Manager manager = new Manager(); Director director = new Director(); //line n1 } Which two options fail to compile when placed at line n1 of the main method?

Options

  • Aemployee.salary = 50_000;
  • Bdirector.salary = 80_000;
  • Cemployee.budget = 200_000;
  • Dmanager.budget = 1_000_000;
  • Emanager.stockOption = 500;
  • Fdirector.stockOptions = 1_000;

Unlock 1Z0-808 to see the answer

You've previewed enough free 1Z0-808 questions. Unlock 1Z0-808 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.

Topics

#inheritance#field access#class hierarchy#compilation errors
Full 1Z0-808 Practice