ChrisMinich / mario

0 stars 0 forks source link

Try with Resources #4

Open mpmenne opened 10 years ago

mpmenne commented 10 years ago

Hey great job remembering to close your connection to your file stream. Awesome!

You did it absolutely correctly; however, in Java 7 an easier way to manage Streams was introduced. It's called Try-With-Resources. Here's a video

http://tv.launchcode.us/#/videos/java_try_with_resources?lesson=Java

See what you think and try it out in your code just for fun.

ChrisMinich commented 10 years ago

I have now closed my output stream using Try-With-Resources. What about where I am reading input from bufferedReader? Is that Try correct? BTW, your video mentioning to check the setting in the IDE was prescient. Very nice.