Why does the following code throw a CloneNotSupportedException in JDK7 but NOT in JDK6 ?
public class DemoThread extends Thread implements Cloneable { public static void main(String[] args) { DemoThread t = new DemoThread(); t.cloned(); } public DemoThread cloned() { try { return (DemoThread) super.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } return null; } }
Manish
source share