public class Test {
    public static void main(String[] args) throws CloneNotSupportedException {
        
        A a1 = new A();
        A a2 = (A) a1.clone();
        
        System.out.println(a1 == a2);
        System.out.println(a1.min == a2.min);
        System.out.println(a1.max == a2.max);
    }
}
class A implements Cloneable {
    Integer min = new Integer(100);
    Integer max = new Integer(1000);
    
    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
Login in to like
Login in to comment