Hi,
Sorry in advance if this is a stupid question.
Could somebody please explain why the order of lines in the output varies everytime I execute the following program.
I have received three different output cases. They are as follows.
run:
java.lang.Exception: Exception Again
hello
Not Terminated yet
at TestSimple.ExceptionTest2.workonExceptions(ExceptionTest2.java:25)
at TestSimple.ExceptionTest2.main(ExceptionTest2.java:14)
BUILD SUCCESSFUL (total time: 0 seconds)
run:
hello
java.lang.Exception: Exception Again
Not Terminated yet
at TestSimple.ExceptionTest2.workonExceptions(ExceptionTest2.java:25)
at TestSimple.ExceptionTest2.main(ExceptionTest2.java:14)
BUILD SUCCESSFUL (total time: 0 seconds)
run:
hello
Not Terminated yet
java.lang.Exception: Exception Again
at TestSimple.ExceptionTest2.workonExceptions(ExceptionTest2.java:25)
at TestSimple.ExceptionTest2.main(ExceptionTest2.java:14)
BUILD SUCCESSFUL (total time: 0 seconds)
I just don't see why stackprinttrace should start before hello is printed. Also in the third run, even 'Not Terminated yet' is printed before stacktrace has started. I can't understand this behaviour. Is this related to threads? Does printstacktrace run as a separate thread or something? Could somebody please advice.
Thanks.
Sorry in advance if this is a stupid question.
Could somebody please explain why the order of lines in the output varies everytime I execute the following program.
I have received three different output cases. They are as follows.
run:
java.lang.Exception: Exception Again
hello
Not Terminated yet
at TestSimple.ExceptionTest2.workonExceptions(ExceptionTest2.java:25)
at TestSimple.ExceptionTest2.main(ExceptionTest2.java:14)
BUILD SUCCESSFUL (total time: 0 seconds)
run:
hello
java.lang.Exception: Exception Again
Not Terminated yet
at TestSimple.ExceptionTest2.workonExceptions(ExceptionTest2.java:25)
at TestSimple.ExceptionTest2.main(ExceptionTest2.java:14)
BUILD SUCCESSFUL (total time: 0 seconds)
run:
hello
Not Terminated yet
java.lang.Exception: Exception Again
at TestSimple.ExceptionTest2.workonExceptions(ExceptionTest2.java:25)
at TestSimple.ExceptionTest2.main(ExceptionTest2.java:14)
BUILD SUCCESSFUL (total time: 0 seconds)
I just don't see why stackprinttrace should start before hello is printed. Also in the third run, even 'Not Terminated yet' is printed before stacktrace has started. I can't understand this behaviour. Is this related to threads? Does printstacktrace run as a separate thread or something? Could somebody please advice.
Thanks.