class Emp
{
int bonus =4000;
void showbonus()
{
System.out.println("bonus is"+bonus);
}
}
class pro extends Emp
{
int sal=25000;
}
class p1 extends pro
{
int tot;
public static void main(String[] args)
{
p1 p =new p1();
p.tot=p.bonus+p.sal;
p.showbonus();
System.out.println("total salary is "+p.tot);
}
};
No comments:
Post a Comment