OnJava8-Examples/concurrency/NaiveExceptionHandling.java
Bruce Eckel 7265b6aceb Updated to match book
Partway through update
2015-04-29 12:53:35 -07:00

16 lines
447 B
Java

//: concurrency/NaiveExceptionHandling.java
// {ThrowsException}
import java.util.concurrent.*;
public class NaiveExceptionHandling {
public static void main(String[] args) {
try {
ExecutorService exec =
Executors.newCachedThreadPool();
exec.execute(new ExceptionThread());
} catch(RuntimeException ue) {
// This statement will NOT execute!
System.out.println("Exception was handled!");
}
}
} ///:~