Oracle
1Z0-808 · Question #18
You are asked to develop a program for a shopping application, and you are given the following information: The application must contain the classes Toy, EduToy, and ConsToy. The Toy class is the…
Sign in or unlock 1Z0-808 to reveal the answer and full explanation for question #18. The question stem and answer options stay visible for context.
Advanced Class Design
Question
You are asked to develop a program for a shopping application, and you are given the following information:
- The application must contain the classes Toy, EduToy, and ConsToy.
- The Toy class is the superclass of the other two classes.
- The int calculatePrice (Toy t) method calculates the price of a toy.
- The void printToy (Toy t) method prints the details of a toy.
Options
- Apublic abstract class Toy { public abstract int calculatePrice(Toy t); public void printToy(Toy t) { /* code goes here */ } }
- Bpublic abstract class Toy { public int calculatePrice(Toy t); public void printToy(Toy t); }
- Cpublic abstract class Toy { public int calculatePrice(Toy t); public final void printToy(Toy t) { /* code goes here */ } }
- Dpublic abstract class Toy { public abstract int calculatePrice(Toy t) { /* code goes here / } public abstract void printToy(Toy t) { / code goes here */ } }
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
#abstract class#abstract methods#class hierarchy#final methods