INHERITANCE This is the property by which the object of one class acquires the property of another class. The inheritance is acquired by using the keyword 'extends' e The different types of inheritance are Single Inheritance Multiple Inheritance Multilevel Inheritance Hierarchical Inheritance Hybrid Inheritance :
Class A Class A Class A Class B Class A Class B Class C Class B Class BClassC Class C Single Inheritance Multilevel Inheritance Hierarchical Inheritance Multiple Inheritance Class A Class B Class C Class D
INHERITANCE PROGRAM class Triangle double base-10; double height-1.5; void showdim() System.out.println(The base is"+base+"and height is"+height); class TriangleArea extends Triangle double area()
System.out.println("The area of the triangle is"+(base height)/2); System.out.println("The area of the triangle is"+ (base*height)/2); class TriangleDemo public static void main(String args) TriangleArea obj=new TriangleArea ( ) ; obi.showDim obj.area); );
Hey everyone,I am Kshethra. I really love explaining to someone it somehow turned up to my passion.I'm really happy to fulfill my passion .