Can you explain the output of this code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

6th Aug 2021, 2:26 AM
Rishi
Rishi - avatar
1 Answer
+ 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
6th Aug 2021, 2:38 AM
Arsenic
Arsenic - avatar