Question: For each line of code in the main method, indicate which class the method being executed comes from and the result of executing that method
For each line of code in the main method, indicate which class the method being executed comes from and the result of executing that method
Example
Calls constructor from Star class which actually calls constructor from A Class and creates new RedGiant object
Calls setMass from the B Class which the RedGiant object inherited and sets the instance variable mass inherited from the Star Class to
Calls getMass from the C Class which the RedGiant object inherited and prints the value of the mass that was set in line
Calls doubleMass from the D Class
public class Star
private double mass;
public void setMass double mass
this.mass mass;
pubic double getMass
return this.mass;
private double doubleMass
return this.mass;
public class RedGiant extends Star
public static void main String args
RedGiant rg new RedGiant; #
rgsetMass; #
System.outprintln rggetMass; #
System.outprintln rgdoubleMass; #
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
