Palak enters a coding competition she wants to write code to pass down values from one class to another. Which of following concept should she use to do so ?
D. All of the mentioned
Answer : C. Extends
- A class in Java can extend another class to become a subclass. When class B extends the class A, B becomes subclass (child) and A becomes superclass (parent). A subclass can reuse all the features of the parent class and code reuse is a major reason for extending a class