Programming in Java
Object Oriented in Java
Advanced topics in Java
Modal Box
Tutorials
C is a very powerful and widely used language. It is used in many scientific programming situations. It forms (or is the basis for) the core of the modern languages Java and C++. It allows you access to the bare bones of your computer.C++ is used for operating systems, games, embedded software, autonomous cars and medical technology, as well as many other applications. Don't forget to visit this section...
Inheritance in java
Inheritance we can say is the (super-sub) or (parent-child) or (base-derived) class relationship.
Inheritance is the main feature of object oriented programming through which the sub class inherits the features of its base class.
Types of Inheritance
1. Single Inheritance :
If a class inherits the features of another class, then it is known as single inheritance.
In java, a class inherits another class with the keyword ‘extends’.
class A { int i; }
class B extends A //how class inherits another class. { int j; // now this class automatically has i inherited variable. }
2. Hierarchical Inheritance :
In this type of inheritance, multiple classes inherit the same class.
class A { } class B extends A { } class C extends A { }
3. Multilevel Inheritance :
Multilevel inheritance can be understand with the below example.
class A { } class B extends A { } class C extends B { }
In the above example, class C inherits A but not directly, it inherits through B class.
Video/ C Introduction
Watch video in full size