I\'m having a small problem in Java. I have an interface called Modifiable. Objects implementing this interface are Modifiable.
I also have a ModifyCommand class (wi
Adding to Sean Reilly's answer, this should solve your problem, and is more type safe. It compiles and runs fine with me on JDK6:
public interface Modifiable> extends Cloneable {
T clone();
}
public class Test implements Modifiable {
@Override
public Test clone() {
System.out.println("clone");
return null;
}
public static void main(String[] args) {
Test t = new Test().clone();
}
}
I couldn't test it with Java 5 because I don't have it installed, but I guess it would work fine.