fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. System.out.println("Started parent! ");
  13. Thread child = new Thread(){
  14. public void run () {
  15. try {
  16. System.out.println("Started Child ! ");
  17. Object obj = null;
  18. throw new NullPointerException("efnlksd");
  19. } catch (NullPointerException e) {
  20. System.out.println("AAhhh Exception occured.. But no way of telling parent");
  21. throw new RuntimeException("Hoping this reaches the parent! as NPE but it wont", e);
  22. }
  23. }
  24. };
  25. child.start();
  26.  
  27. System.out.println("Everything Ran in Parent!");}
  28. }
Success #stdin #stdout #stderr 0.06s 32320KB
stdin
Standard input is empty
stdout
Started parent! 
Everything Ran in Parent!
Started Child ! 
AAhhh Exception occured.. But no way of telling parent
stderr
Exception in thread "Thread-0" java.lang.RuntimeException: Hoping this reaches the parent! as NPE but it wont
	at Ideone$1.run(Main.java:21)
Caused by: java.lang.NullPointerException: efnlksd
	at Ideone$1.run(Main.java:18)