New to Java? Here Are Some Resources

In this tweet, I was asked if I had a list of resources for developers who are new to Java. I didn't at the time, but I've spent some time researching, and here is that list.

I've listed content that is both free and paid. It's not that one type is superior; it’s just to give you plenty of choices. These are the resources that I've used and do still use to re-learn Java. So, if you're new to Java or looking to pick it up again after a break, this blog is for you.

Avoid Method Chaining When Using Multiple AutoCloseable Instances

The try-with-resources statement introduced in Java 7 allows us to adopt an approach where certain objects could be opened, being visible in the try block, and immediately closed when the execution reaches the end of that scope. This was a huge improvement for managing scarce resources, in comparison with the old approach of overriding the finalize() method (which we never exactly know when  will be executed.)

Over the years, I was repeatedly seeing the following approach on some applications, which motivated me to write this post. Consider this code snippet for executing an SQL statement using JDBC: