Few months ago few of my friends and me attended a seminar conducted by SUN in which they showcased the latest version of Java, Java 1.5. I took down some notes based on the seminar regarding the features. Some of them which I remember and understood are enlisted below.
1. It uses a parallel garbage collector rather than the serial garbage collector.
2. Objects in a collection can be defined at compile time.
eg. ArrayList<Integer>
3. Support for foreach for looping through objects in a collection
eg. ArrayList<Integer>
for(Integer i : list) {.....}
4. Just like in .Net the concept of auto boxing and unboxing is supported for primitive types.
eg. Integer i0=22;
in i=i0;
5. There is support for variable arguments. Varargs support.
6. There is support for importing only the statics of a class.
eg. old code - double m=Physics.AVOGADRO * mole;
new code - import static Physics;
........
m=AVOGADRO * mole;
7. There is support to add annotation and metadata which can then be read by the java compiler and depending on configuration can be stored in class files. These can be later used by development and runtime tools to generate additional source code or to provide more information during debugging.
8. Enumerated Types supported to replace static final constants
eg. public enum counter { one, two, three };
9. Just like in C Java now supports formatted output using System.out.printf.
10. There is also support to read formatted output.
I am not sure if I have enumerated all the new features. So in case I have missed anything or I have misintepreted something please add it as a comment.
For further details visit the site Java
1 comment:
Tiger is quite interesting.
Thanks for putting it down vivek.
this short note is quite useful.
Sun is too fast man . people have just started using java5 and they have launched developent for java 7(dolphin). lets see what comes out of mustang(java 6) , now that they have invited opensource community into the project .
Post a Comment