Previous-year question practice database
Answer
Exam answer
Inheritance is the process by which one class (the derived or child class) acquires the variables and methods of another class (the base or parent class), and may add features of its own.
Example: class Car extends Vehicle — Car inherits everything defined in Vehicle.
Explanation
Define it and give the keyword: extends is what establishes inheritance in Java, and naming it strengthens the answer. Add the reason it exists — reusability. Code written once in the parent class need not be written again in every child class. That single sentence turns a definition into an explanation. Keep it apart from the other three principles: polymorphism (one name, many forms), encapsulation (binding and hiding data), abstraction (hiding complexity).
More from Encapsulation
Which of the following is NOT an access specifier?2026Post office is an example for __________ access specifier.2025The access specifier that gives least accessibility is __________.2024Assertion (A): Static method can access static and instance variables.
Reason (R): Static variables can be accessed only by static method.2024A mechanism where one class acquires the properties of another class:2023A method which is a part of a class rather than an instance of the class is termed as:2023