Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
35 views

Program To Show Inheritance

The program demonstrates inheritance by defining a Father class with an integer field a, then defining a Child class that extends Father and is able to access the inherited field a to print its value of 10 in the main method.

Uploaded by

Akanksha Gupta
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

Program To Show Inheritance

The program demonstrates inheritance by defining a Father class with an integer field a, then defining a Child class that extends Father and is able to access the inherited field a to print its value of 10 in the main method.

Uploaded by

Akanksha Gupta
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

//Program to show inheritance

class Father { final int a=10; }

class Child extends Father { public static void main(String arg[]) { Child c=new Child(); System.out.println(c.a); } }

You might also like