What is meant by inheritance ? Explain with an example.
Inheritance is the mechanism of using the features of one class into another class.The class which acquire the properties of another class (super class)is called subclass or drived class.
Java provides the keyword \'extends\' to support the Inheritance.
Example:
package p1; public class SuperClass{ void show(){ System.out.println(\"Super class\"); } } class SubClass extends SuperClass{ public static void main(String[] args){ SubClass s=new SubClass(); s.show(); } }