+ 2
Can you explain the output of this code?
Why does the "first caught int exception" line come at last, instead of coming after the line "last thrown int exception"? Thank you already :) https://code.sololearn.com/c8Jdia6PvSF1/?ref=app
1 Odpowiedź
+ 5
This is because the string "first caught int exception" is printed on stderr and "last line thrown int exception" is printed on stdout.
And unlike your local machine, on sololearn, they both are not same, but two seperate files instead and after complete execution of your program on their servers, the contents of stderr is concatenated at the end of stdout and the resultant file is sent to your device, thus the result.
You can see the similar behaviour in the following thread 👇
https://www.sololearn.com/Discuss/2686531/?ref=app