Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

PROGRAM TO IMPLEMENT MULTIPLE INHERITANCE

PROGRAM
import java.io.*;
class Student
{
String name,address,s;
byte age[]=new byte[2];
}
interface IOListener
{
public void readData();
public void displayData();
}
class CollegeStudent extends Student implements IOListener
{

String course,univer,colg;
public void readData()
{
try
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter Name:");
name=br.readLine();
System.out.println("Enter Address:");
address=br.readLine();
System.out.println("Enter Age:");
s=br.readLine();
age=s.getBytes();
System.out.println("Enter Course:");
course=br.readLine();
System.out.println("Enter College:");
colg=br.readLine();
System.out.println("Enter University:");
univer=br.readLine();
}
catch(Exception e)
{ }
}
public void displayData()
{
System.out.print("\nName :"+name);
System.out.print("\nAddress :"+address);
System.out.print("\nAge :"+new String(age));
System.out.print("\nCourse :"+course);
System.out.print("\nCollege :"+colg);
System.out.print("\nUniversity :"+univer);
}
public static void main(String arg[])
{
CollegeStudent ob=new CollegeStudent();
ob.readData();
ob.displayData();
}

}

OUTPUT

Enter Name:
Ambily
Enter Address:
NS Bhavan
Enter Age:
22
Enter Course:
MCA
Enter College:
CHMM
Enter University:
Kerala

Name :Ambily
Address :NS Bhavan
Age :22
Course :MCA
College :CHMM
University :Kerala

PROGRAM TO Implement Multiple Inheritance is a post from ShoutToWorld - Let's Learn Let's Shout - Helping bloggers and developers.



This post first appeared on ShoutToWorld, please read the originial post: here

Share the post

PROGRAM TO IMPLEMENT MULTIPLE INHERITANCE

×

Subscribe to Shouttoworld

Get updates delivered right to your inbox!

Thank you for your subscription

×