+ 1
how i will add bonus with salary in this program :-
class Employee{ float salary=40000; } class Programmer extends Employee{ int bonus=10000; public static void main(String args[]){ Programmer p=new Programmer(); System.out.println("Programmer salary is:"+p.salary); System.out.println("Bonus of Programmer is:"+p.bonus); } }
2 Réponses
+ 1
are you looking for something like this ?
I dont realy understand the question ^^
System.out.println("Salary with bonus:"+(p.bonus+p.salary));
+ 2
@ Chrizzhigh Yes , Thank You!