Posts

Showing posts from 2011

New Language Features in JDK7

Image
New Language Features in JDK 7  This blog series will cover some of the new language features available in Java7.  To start with, lets cover some changes that are available under the pseudonym " Project Coin" or in the Community parlance JSR334 .The main theme of " Project Coin" according to its Spec Lead Joseph Darcy is " making things programmers do every day easier" . Since Project Coin itself contains a number of small language changes, lets look at them one at a time. The first language change we will be discussing is called " Strings in Switch" . Strings in Switch To understand this language feature, lets look at a simple use-case - a method that checks the input and prints the matching color. Prior to Java7, there were generally 2 options available to achieve this. Lets look at them one by one:   Option 1 : This the most obvious and simple way of using multiple if-else blocks to check and valid...