Cloning using a copy factory

suggest change
public class Sheep {

    private String name;
    
    private int weight;
    
    public Sheep(String name, int weight) {
        this.name = name;
        this.weight = weight;
    }
    
    public static Sheep newInstance(Sheep other);
        return new Sheep(other.name, other.weight)
    }

}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents