try-with-resources
A resource that implements AutoCloseable is closed when the try block ends, in reverse order of acquisition.
Related reading: Exceptions
Curriculum file: versions2Java7Features.java
JDK 7 · JSR 336
Java SE 7 is JSR 336. Oracle’s specification index dates the release to July 2011. The language changes are the small Project Coin set. The larger library and JVM changes are NIO.2, Fork/Join, and invokedynamic.
A resource that implements AutoCloseable is closed when the try block ends, in reverse order of acquisition.
Related reading: Exceptions
Curriculum file: versions2Java7Features.java
The constructor type arguments can be omitted when the variable’s type already supplies them.
Curriculum file: versions2Java7Features.java
A switch can select on a string. The example uses the Java 7 form: colon labels and break, not arrow labels.
Related reading: Control flow
Curriculum file: versions2Java7Features.java
One catch clause can list more than one exception type.
Related reading: Exceptions
Curriculum file: versions2Java7Features.java
Integer literals can be written in binary, and underscores can separate digits.
Curriculum file: versions2Java7Features.java
java.nio.file adds Path and Files for file-system work that the older File API did not cover well.
Related reading: File I/O and NIO
A work-stealing pool for divide-and-conquer tasks. It is a library, not the virtual-thread API that arrives later.
Related reading: Concurrency
A JVM instruction for dynamic call sites. Java 8 lambdas later depend on this kind of linkage. It is not a new expression in Java 7 source.
The Java 7 example uses only Project Coin syntax: diamond, try-with-resources, a colon string switch, multi-catch, underscores, and binary literals. It does not use lambdas or switch arrows.
Sources. Release month and JSR 336: Oracle Java SE specifications. Feature set: the Java versions reference and versions2Java7Features.java in this curriculum. Oracle Java SE specifications (leaves JavaMastery)