Rotate your phone or change to desktop for better experience

Rotate your phone or change to desktop for better experience

Pgm 8 || Write a program to demonstrate single level inheritance.

 class Employee

{

void salary()

{

System.out.println("Salary= 200000");

}

}

class Programmer extends Employee

{

void bonus()

{

System.out.println("Bonus=50000");

}

}

class Pgm8

{

public static void main(String args[])

{

Programmer p = new Programmer();

p.salary();

p.bonus();

}

}

Post a Comment

0 Comments