public class test implements Cloneable {
@Override
public test clone() {
return (test) super.clone();
}
public static void main(String[] args) {
new test().clone();
}
}
I get error: unreported exception CloneNotSupportedException
when I try to compile this (at line 4, not the main). As far as I can tell, the entire purpose of implementing Cloneable
is to get rid of the exception.
- Is there a way to use
super.clone()
without throwing or catching the exception? - Does the interface actually do anything?