Program to Implement Overloading of Methods
class prnt
{
int a, a1, s, s1;
void show()
{
System.out.println("Father name: Mr.Roshan lal");
System.out.println("Mother Name: Mrs. Madhu Gupta") ;
}
}
class radha extends prnt
{
void get(int y)
{
a = 19;
s = y;
}
void show1()
{
System.out.println("\nstd name:Radha Garg");
System.out.println("age:" + a);
System.out.println("salary:" + s);
}
}
class money extends radha
{
void get(int x1,int y1)
{
a1 = x1;
s1 = y1;
}
void show2()
{
System.out.println("\nstd name:Money Garg");
System.out.println("age:" + a1);
System.out.println("salary:" + s1);
}
void shows()
{
show();
show1();
show2();
}
}
class overloading
{
public static void main(String z[])
{
money m = new money();
m.get(20,30000);
m.get(25000);
m.shows();
}
}
class prnt
{
int a, a1, s, s1;
void show()
{
System.out.println("Father name: Mr.Roshan lal");
System.out.println("Mother Name: Mrs. Madhu Gupta") ;
}
}
class radha extends prnt
{
void get(int y)
{
a = 19;
s = y;
}
void show1()
{
System.out.println("\nstd name:Radha Garg");
System.out.println("age:" + a);
System.out.println("salary:" + s);
}
}
class money extends radha
{
void get(int x1,int y1)
{
a1 = x1;
s1 = y1;
}
void show2()
{
System.out.println("\nstd name:Money Garg");
System.out.println("age:" + a1);
System.out.println("salary:" + s1);
}
void shows()
{
show();
show1();
show2();
}
}
class overloading
{
public static void main(String z[])
{
money m = new money();
m.get(20,30000);
m.get(25000);
m.shows();
}
}