Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b4BL3cEPHQTk2McE7C
14 lines
348 B
Java
14 lines
348 B
Java
/** Implements Cloneable but forgets to override clone(), then calls it. Does not compile. */
|
|
public class ForgotToOverride {
|
|
|
|
static class Foo implements Cloneable {
|
|
int x = 1;
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
Foo foo = new Foo();
|
|
Object copy = foo.clone();
|
|
System.out.println(copy);
|
|
}
|
|
}
|