Question: Supplied code public class ObjectToClone { private static final int NUM_QUARTERS = 4; private int monthDay; private String companyName; private double[] returnValues; private static int

Supplied code
public class ObjectToClone
{
private static final int NUM_QUARTERS = 4;
private int monthDay;
private String companyName;
private double[] returnValues;
private static int numReports = 0;
public ObjectToClone(String companyName, int monthDay)
{
this.monthDay = monthDay;
this.companyName = companyName;
numReports++;
returnValues = new double[numReports *NUM_QUARTERS ];
for(int i = 0; i
returnValues[i] = Math.random();
}
}
}
Considering the ObjectToClone class below, write a clone method for the class which will return a full deep copy of the object. The return type of your clone method must be ObjectToClone. Your solution must consist of a clone method only (i.e., you should not write any additional constructors or instance methods)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
