X813: Cloning 2 Deep Copy

For the following question assume the following class definition of Ball

public class Ball{
    private double diameter;
    private String color;
    private boolean isInflatable;

    public Ball(double d, String c, boolean inf) {
        diameter = d;
        color = c;
        isInflatable = inf;
    }

    public double getDiameter() {
        return diameter;
    }
    public String getColor() {
        return color;
    }
    public void setColor(String c){
        color = c;
    }
    public boolean getIsInflatable() {
        return isInflatable;
    }

}// end Ball

Write a method that will take in an array of Ball objects and return a deep copy of that array.

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.