New Changes in JDK7

JDK7 is packaged with these new changes
– Small language changes
– NIO-2 Enhanced NIO
– invokedynamic
– other features

Small language Changes:

  • Now integer can accept binary format (along with octal and hexadecimal values)
<pre>int i = 0b10110
  • Switch statement can accept string variables. Since String object in Java is considered immutable, java community has come up with this concept


public int useSwitch(String strCase) {
switch(strCase) {
case "A":
return 1;
case "B":
return 2;
return 10;
  • Inferring types with <>: while using generics RHS of stmt can be replaced with just <>


List<String> list = new ArrayList<>();

Note: No need to explicitly mentioned type on the RHS

  • Easy rethrow (replace multiple catch blocks with single catch block)


try {
// Reflective operations calling Class.forName,
// Class.newInstance, Class.getMethod,
// Method.invoke, etc.
} catch(final FileNotFoundException |
SQLException |
ClassNotFoundException) {
throw e;

// try with resources
try (InputStream in = new FileInputStream(src);
OutputStream out = new FileOutputStream(ds)) {
byte[] buf = new byte[8192];
int n;
while ((n = >= 0)
out.write(buf, 0, n);

NIO-2 Enhanced NIO
NIO-2 (Enhanced Asynchronous NIO)

Dynamic linking of method by the JVM is introduced

Other Features:
Fork joins (for recursive functionalities) – Multi process environment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


Mostly technology with occasional sprinkling of other random thoughts


Amir Amintabar's personal page

101 Books

Reading my way through Time Magazine's 100 Greatest Novels since 1923 (plus Ulysses)

Seek, Plunnge and more...

My words, my world...

ARRM Foundation

Do not wait for leaders; do it alone, person to person - Mother Teresa

Executive Management

An unexamined life is not worth living – Socrates


A topnotch site


Just another site

coding algorithms

"An approximate answer to the right problem is worth a good deal more than an exact answer to an approximate problem." -- John Tukey

%d bloggers like this: