Category: New Features in Java 7

Catching Multiple Exception Types in a single catch block in Java 7

Prior to Java 7, if one needed to have common handling for different type of exceptions, one needed to write duplicate code. I.e. one had to repeat the handling code to make it common across exception types. Java 7, on the other hand, allowed Java a single catch block to handle multiple exceptions … Continue reading Catching Multiple Exception Types in a single catch block in Java 7

Diamond Operator in JDK 7 or Java 7 explained with example

Tutorial first explains how defining a collection until Java 6 was more cumbersome, and then shows usage of diamond operator which eases collection definition in Java 7 … Continue reading Diamond Operator in JDK 7 or Java 7 explained with example

String in switch case in java 7

Prior to Java 7 the Switch-Case statement did not have support for String data types. This anomaly has been corrected with Java adding support for String in Switch Case in Java 7. This article shows how strings can be used in switch case. As per Java documentation the byte code of Switch-Case statement holds a slight … Continue reading String in switch case in java 7