O'Reilly logo

Java 7 New Features Cookbook by Jennifer L. Reese, Richard M. Reese

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 1. Java Language Improvements

In this chapter, we will cover the following:

  • Using string literals in switch statements

  • Using underscores in literals to improve code readability

  • Using the try-with-resources block to improve exception handling code

  • Creating a resource that can be used with the try-with-resources technique

  • Catching multiple exception types to improve type checking

  • Re-throwing exceptions in Java 7

  • Using the diamond operator for constructor type inference

  • Using the @SafeVarargs annotation

Introduction

Java 7 was released in July of 2011 and introduced a number of new features. In the Java SDK documentation, you may see it referred to as Java 1.7. This chapter will focus on those that have been grouped as part of the Project Coin (

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required