try {
Thread t = new Thread() {
public void run() {
try {
Thread.sleep(2500);
} catch (Throwable ex) {
System.out.println("Caught in run: " + ex);
}
}
};
t.start();
// Give t time to get going...
Thread.sleep(1000);
t.stop(); // EXPECT COMPILER WARNING
} catch (Throwable t) {
System.out.println("Caught in main: " + t);
}