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 caicuiatePrice (Toy t) method calculates the price of a toy.
The void printToy (Toy t) method prints the details of a toy.
Which definition of the Toy class adds a valid layer of abstraction to the class hierarchy? 1. public abstract class Toy{ public abstreact int caicuiatePrice (Toy t) ; void printToy (Toy t) {/*code goes here*/} }
2. public abstract class Toy{ public int caicuiatePrice (Toy t) ; void printToy (Toy t); } 3. Access Mostly Uused Products by 50000+ Subscribers public abstract class Toy{ public int caicuiatePrice (Toy t) ; public final void printToy (Toy t) {/*code goes here*/} }
4. public abstract class Toy{ public abstract int caicuiatePrice(Toy t){/*Code goes here*/} ; void printToy (Toy t){/*Code goes here*/}; }
1. Adding the public modifier to the declaration of method1 at line n1 2. Removing the public modifier from the definition of method1 at line n2 3. Access Mostly Uused Products by 50000+ Subscribers 4. Changing the line n4 DoClass doi = new DoClass ( );