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

Inheritance in Java


Code ResourceAuthor: Raju  

Difficulty Level:

Published: 4th Sep 2007   Read: 1501 times  

Filed in: Java
Add Comment


 


This program comprises of using a inhertance in java as shown in the program. A is the class, B is the another class. class A is inherited by the class B.

 


Sample Code
  1.  
  2. INHERITANCE
  3. class A
  4. {
  5.         int i=10,j=20;
  6.         void abc()
  7.         {
  8.                 System.out.println("abc");
  9.         }
  10.        
  11. }
  12. class B extends A
  13. {
  14.         int k;
  15.         void xyz()
  16.         {
  17.                 System.out.println("xyz");
  18.         }
  19. }
  20. class Display1
  21. {
  22.         public static void main(String args[])
  23.         {
  24.                 B a1= new B();
  25.                 a1.abc();
  26.         }
  27.        
  28. }
  29.  
Copyright GeekInterview.com


Next Article: Creating objects 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. srinivasaraobora22476
4. bora_srinivasarao11728
5. Kiran.jakkaraju4609
6. parmod kumar duhan4501
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