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

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 class Program {
public static void main(String[] args){
Developer dev1= new Developer ("Alice",5000);
Developer dev2= new Developer();
System.out.println("Salary of "+ dev1.getName()+
" is: "+ dev1.getSalary ());
System,out.printin("Salary of "+ dev2. getNam()+
" is: "+ dev2.getSalary());
dev2.increaseSalary (1000);
System.out.println(dev1=e dev2);
dev1= dev2;
System.out.println(dev1== dev2);
dev1.increaseSalary (200);
System.out.println("Salary of "+ dev1.getName()+
}
" is: "+ dev1.getSalary());
}
public class Developer {
private String name;
private double salary;
public Developer(String name, double salary){ this. name = name;
}
this.salary = salary;
public Developer(){
this. name = "Bob";
}
this.salary =6000;
public String getName(){
return name;
}
public double getSalary(){ return salary;
}
public void increaseSalary(double increment) & this.salary + increment;
}
}.
 5 Consider the following Java classes, Program.java and Developer.java. Write down

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!