What is inheritance?
Inheritance is the ability of objects in
java to inherit properties and methods from other objects. When an object inherits from another object it can add its own properties and methods. The object that is being inherited from is called the parent or base class and the class that is inheriting from the parent is called the child or derived class.
How to use inheritance
We will first create a parent class called Person. We will then create a child class called Student. Then we will create a program to use the Student class. The following is a Person class which has a variable...
Posted in: Java,learning programming,Programming
Email This
BlogThis!
Share to Facebook
0 comments:
Post a Comment