Single Inheritance Example in Java


Here is the simple program for printing basic example using Single Inheritance in Java.

Source Code

import java.io.*;
import java.util.Scanner;
//www.tutorjoes.com
class parent
{
  public void display()
  {
    System.out.print("\nThis is Parent Class");
  }
}
class child extends parent
{
  public void display1()
  {
    System.out.print("\nThis is Child Class");
  }
}
class main_fun
{
  public static void main(String args[])
  {
    child o1 =new child();
    o1.display();
    o1.display1();
  }
}
To download raw file Click Here

Output

This is Parent Class
This is Child Class


Learn All in Tamil © Designed & Developed By Tutor Joes