79288566

Date: 2024-12-17 16:06:07
Score: 0.5
Natty:
Report link

You can override the clone method without implementing Cloneable. Just call some copy constructor :

public class Foo {
    private final int a;

    private Foo(int a) {
        this.a = a;
    }

    @Override
    public Foo clone() {
        return new Foo(this.a);
    }
}
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: grigouille