Question: JAVA Considering the ObjectToClone class below, write a clone method for the class which will return a full deep copy of the object. The return
JAVA
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). public class ObjectToClone { private static final int NUM_QUARTERS 4; private int monthDay; private String company Name; private double[] returnValues; private static int numReports = 0; public ObjectToclone (String companyName, int monthDay) { this.monthDay = monthDay; this.company Name = company Name; numReports++; return values = new double[numReports *NUM_QUARTERS ]; for(int i = 0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
