Question: 5 Consider the following Java classes, Program.java and Developer.java. Write down the output of the following when you run the Program class. Marks 5 public
Consider the following Java classes, Program.java and Developer.java. Write down the output of the following when you run the Program class.
Marks
public class Program
public static void mainString args
Developer dev new Developer Alice;
Developer dev new Developer;
System.out.printlnSalary of devgetName
is: devgetSalary ;
System,out.printinSalary of dev getNam
is: devgetSalary;
devincreaseSalary ;
System.out.printlndeve dev;
dev dev;
System.out.printlndev dev;
devincreaseSalary ;
System.out.printlnSalary of devgetName
is: devgetSalary;
public class Developer
private String name;
private double salary;
public DeveloperString name, double salary this. name name;
this.salary salary;
public Developer
this. name "Bob";
this.salary ;
public String getName
return name;
public double getSalary return salary;
public void increaseSalarydouble increment & this.salary increment;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
