Prefer Try-With-Resources for Resource Management in Java
Recently, I was reading the great book Effective Java, 3rd Edition by Joshua Bloch. An awesome book that I highly recommend to every Java developer. One of the items that caught my attention was Item 9: Prefer try-with-resources to try-finally. Bloch states: “It may be hard to believe, but even good programmers got this wrong most of the time.” What does that mean, and why is it important? Let’s dive into the details. ...