Java

Program to Implement the Concept of Inheritance

By June 4, 2016 November 9th, 2016 No Comments

/**** Java 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();
}
}

Output:

Screenshot (296)

Leave a Reply