Chapter 1. Introducing Java 7
This chapter covers
- Java as a platform and a language
- Small yet powerful syntax changes
- The try-with-resources statement
- Exception-handling enhancements
Welcome to Java 7. Things around here are a little different than you may be used to. This is a really good thing—we have a lot to explore, now that the dust has settled and Java 7 has been unleashed. By the time you finish this book, you’ll have taken your first steps into a larger world—a world of new features, of software craftsmanship, and of other languages on the Java Virtual Machine (JVM).
We’re going to warm up with a gentle introduction to Java 7, but one that still acquaints you with powerful features. We’ll start by explaining a distinction that is sometimes misunderstood—the duality between the language and the platform.
After that, we’ll introduce Project Coin—a collection of small yet effective new features in Java 7. We’ll show you what’s involved in getting a change to the Java platform accepted, incorporated, and released. With that process covered, we’ll move on to the six main new features that were introduced as part of Project Coin.
You’ll learn new syntax, such as an improved way of handling exceptions (multi-catch) as well as try-with-resources, which helps you avoid bugs in code that deals with files or other resources. By the end of this chapter, you’ll be writing Java in a new way and you’ll be fully primed and ready for the big topics that lie ahead.