• Post Reply Bookmark Topic Watch Topic
  • New Topic

how exceptions work in thread

 
Madhawi Maurya
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Following code give Run time Exception


Error in first excecution:


Error in 2nd Excetion:


how code works in first Error. Please help.
 
Wirianto Djunaidi
Ranch Hand
Posts: 210
Ruby Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume you are wondering why the exception stack trace took place before the "run" print out.

The reason is your "run" is send to System.out and the stacktrace is send to System.err. Since these output streams are typically buffered, it is up to the VM to flush the content to console for you to see. Chances are in your first execution the System.Err got flushed first before System.out.
 
Madhawi Maurya
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Djunaidi to clear my problem.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!