
class Student
{
int Roll;
String Name=new String ( );
}
class Result extends Student
//Inherting Student Class
{
float Mark;
void GetData ( )
{
Roll=523083;
Name=”Mijan”;
Mark=70.75f;
}
void Display ( )
{
System.out.println(“Roll is :”+Roll);
System.out.println(“Name is:”+Name);
System.out.println(“Mark is:”+Mark);
}
}
class inherit
{
public static void main (String
args[])
{
Result R=new Result ( );
R.GetData ( );
R.Display ( );
}
}
No comments:
Post a Comment