Code.GeekInterview.com
  I am new, Sign me up!
 
Code Samples Java
 

Multilevel Inheritance


Code ResourceAuthor: parmod kumar duhan  

Difficulty Level:

Published: 13th Sep 2007   Read: 4501 times  

Filed in: Java
Add Comment


 


It is the enhancement of the concept of inheritance. When a subclass is derived from a derived class then this mechanism is known as the multilevel inheritance. The derived class is called the subclass or child class for it's parent class and this parent class works as the child class for it's just above ( parent ) class. Multilevel inheritance can go up to any number of level.

 


Sample Code
  1.  
  2. class A
  3. {  int x;  int y;  
  4. int get(int p, int q)
  5. {    x=p; y=q;
  6. return(0);  
  7.  }
  8.    void Show()
  9. {      System.out.println(x);    
  10.  }
  11. }
  12. class B extends A
  13. {  void Showb()
  14. {    System.out.println("B");    
  15. }
  16. }
  17. class C extends B
  18. {  void display()
  19. {    System.out.println("C");
  20.  }  
  21. public static void main(String args[]){    A a = new A();    a.get(5,6);    a.Show();    }}
  22. }
Copyright GeekInterview.com


Next Article: Multilevel Inheritance in Java


 

Latest Code Samples

 

Popular Code Samples

 

Related Code Samples

 

Post Comment


Members Please Login

Name:  Email: (Optional. Used for Notification)

Title:
 
Comment:
Validation Code: <=>  (Enter this code in text box)





Popular Coders

# Coder NameHits
1. iamdvr35750
2. venki_madesh30853
3. srinivasaraobora22477
4. bora_srinivasarao11728
5. Kiran.jakkaraju4609
6. parmod kumar duhan4502
7. chowsys3970
8. Venkateswara Rao3713
9. Raju3390
10. Vamshidhar Matam2290

Active Coders

Refined Tags

 

Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact  

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape