Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started