December 13, 2006

Java 5.0 ” Tiger”

Filed under: Java — khangharoth @ 3:40 am

Well as Sun is about to launch Musthang ,most of us has still not started using Java 5.0 to its full potential.

Well if you are using Eclipse than its version 3.1 onwards has incoprated the support for Tiger but default

setting are still to Jdk 1.4 which is kind of Sad as eclipse guys should have done this.Anyway you can go to

windows—>prefrences—->java —>compiler –>compiler compliance level to 5.0

Their are numerous changes but as a programmer we guys would be mainly concerned with the “Language Features”

So they are :

· Generics

· Enumerated types

· Automatic Boxing and Unboxing of Primitive Values

· Enhanced for loop

· Static Import

· Varargs

Just go through the links and you’ll get hang of these.Even if you are short of time i’ll recommend “Generics “

“Enhanced For Loop” as effect of these featurs on a code from readability prespective is huge.

Here their are doubts about performance while using these features so lets analyse them.

1) In Generics ,their is no impact on Run-time performance as compiler would remove them from class files!

Yes this is only compile time check and ArrayList<Interger> a=new ArrayList<Interger>(); and

ArrayList a=new ArrayList(); will be same at Run-time.Compiler will do the explict casting in the code

and not you so code will be cleaner and easier to read.

2) In AutoBoxing and unBoxing again performance will be same as whaterver casting you would have done will

be done by compiler but essentially the code will be same.

But be carefull while using this feature with Gernerics ,see the code below

ArrayList<Integer> intArraylist=new ArrayList<Integer>();


int num=intArraylist.get(0);


And boom their will be nullPointer when ideally you were dealing with primitives.

But still this is easier to debug than nasty ClassCastException as somebody has added

some other class in ArrayList.Dont worry about this in Tiger.

One more thing worth metioning is Concurrency Utilities : A comprehensive library of concurrency utilities has been developed and included in Java 5.0





1 Comment »

  1. Google is the best search engine

    Comment by Kathy Lawrence — January 19, 2007 @ 12:33 am | Reply

RSS feed for comments on this post. TrackBack URI

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 )

Google+ photo

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

Twitter picture

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

Facebook photo

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


Connecting to %s

Create a free website or blog at

%d bloggers like this: