Program to Implement the Concept of Inheritance
class prnt
{
int a, s;
void show()
{
System.out.println("Fathre name: Mr. Roshan Lal");
}
}
class radha extends prnt
{
void get(int x,int y)
{
a = x;
s = y;
}
void show1()
{
show();
System.out.println("Std name: Radha");
System.out.println("age:" + a);
System.out.println("salary:" + s);
}
}
class single_inherit
{
public static void main(String a[])
{
radha m = new radha();
m.get(520,22000);
m.show1();
}
}
class prnt
{
int a, s;
void show()
{
System.out.println("Fathre name: Mr. Roshan Lal");
}
}
class radha extends prnt
{
void get(int x,int y)
{
a = x;
s = y;
}
void show1()
{
show();
System.out.println("Std name: Radha");
System.out.println("age:" + a);
System.out.println("salary:" + s);
}
}
class single_inherit
{
public static void main(String a[])
{
radha m = new radha();
m.get(520,22000);
m.show1();
}
}
No comments:
Post a Comment