Skip to content

Instantly share code, notes, and snippets.

@kirugan
Created December 12, 2018 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kirugan/bde7e45de9ef273b85b2f07b84607489 to your computer and use it in GitHub Desktop.
Save kirugan/bde7e45de9ef273b85b2f07b84607489 to your computer and use it in GitHub Desktop.
Test java exception in multithread env
class Test {
public static void main(String args[]) throws InterruptedException {
Thread t = new Thread() {
public void run() {
System.out.println("Welcome new thread");
throw new RuntimeException("Hey there!");
}
};
// try {
t.run();
// } catch (Exception e){
// System.out.println(e.getMessage());
// }
t.join();
System.out.println("OK");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment