The program opens a resource, obtains a function for writing a string, and then uses this function after exiting the try block. You need to determine the exact output of the current code.
Requirements
- Do not fix anything in the code.
- You must provide the exact stdout of the program when it is run.
- Assume the program is run as a normal console application.
- If an exception is thrown during execution, count only the lines that reached
stdout.
How to reproduce
- Save the files from the task.
- Compile and run the program with:
scalac DeferredWriter.scala && scala DeferredWriter
Expected behavior
- The program is deterministic and does not use user input.
- In your answer, provide the output line by line, preserving case and punctuation.