Previous | Home | Next |
What is difference between jdk1.4 and jdk1.5?
Following is added into jdk1.5 .which was not into jdk1.4:
- Java Language Features
- Generics
- Enhanced for Loop
- Autoboxing/Unboxing
- Typesafe Enums
- Varargs
- Static Import
- Metadata (Annotations)
- Virtual Machine
- Class Data Sharing
- Garbage Collector Ergonomics
- Server-Class Machine Detection
- Thread Priority Changes
- Fatal Error Handling
- High-Precision Timing Support
So many other new features has been added.
Bloch summarizes the answer to this question with two main points saying that Java 5.0 will help shifting the responsibility of writing the boilerplate code from the programmer to the compiler and he believes that the whole will be greater than the sum of its parts.
Generics, Autoboxing, Enhanced for-loop are the features which shift quite a lot coding responsibility from the programmer to the compiler. Humans are error prone and hence shifting the responsibility ultimately not only speeds up the development, but also makes the code more reliable and secure.
This feature allows the programmers to forget about taking care of the iterators obtained from the Collections. The compiler automatically does that and it ensures that the iterators for each element in the Collection they have been obtained from.
Bloch says that having two extra keywords "foreach" and "in" could have made this even more readable and understandable, but that might have compromised with the compatbility with the earlier versions as the clients might have used these two words as identifiers in their programs.
Generics:Provides compile-time (static) type safety for collections and eliminates the need for most typecasts (type conversion).
Also called annotations, allows language constructs such as classes and methods to be tagged with additional data, which can then be processed by metadata- aware utilities
Automatic conversions between primitive types (such as int) and primitive wrapper classes (such as Integer).
The enum keyword creates a typesafe, ordered list of values (such as Day.MONDAY, Day.TUESDAY, etc.). Previously this could only be achieved by non- typesafe constant integers or manually constructed classes (typesafe enum pattern).
The “JDK” is the Java Development Kit.the JDK is bundle of software that you can use to develop Java based software.
The “JRE” is the Java Runtime Environment.the JRE is an implementation of the Java Virtual Machine which actually executes Java programs.
Each JDK contains one (or more) JRE’s along with the various development tools like the Java source compilers, bundling and deployment tools, debuggers, development libraries, etc.
Two steps for a java program ie.,compile and interpret.
- JDK does compilation but JRE can’t.
- Both JRE and JDK does interpretaion.
Previous | Home | Next |