Question: Question 2 (20 points) Write an interface definition called cloneable. It has one method called clone that provides a deep copy of the any class

 Question 2 (20 points) Write an interface definition called cloneable. It

Question 2 (20 points) Write an interface definition called cloneable. It has one method called clone that provides a deep copy of the any class that implements it. A deep copy is defined as a clone method that must create a copy of all instance variable and if the instance variable is an object then the method must make a copy of the object and not just a copy of the reference the object variable stores Suppose we have a class Cat that implements the Cloneable interface (above) with instance fields weight(int), furColor(Color object), age(int), and name(String). Write a class definition for class Cat that implements a parameterized constructor for the instance fields in Cat and the required method defined by the interface. Assume Color class is implemented and contains any methods or constructors you need. No comments or import statements required

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!