JAVA Articles

Java 5

New Features in Java 5

  1. Generics – Provides compile-time type safety while still allowing a type or method to operate on objects of various types.
  2. Enhanced for Loop – The for statement can now be used to iterate over an array and a collection.
  3. Autoboxing/unboxing –  Automatic conversion of primitives to wrapper types and vice versa.
  4. Enum type – A new enumeration type in Java.
  5. Varargs – Allows a method to accept a variable number of arguments.
  6. Static import – Eliminates the need to qualify static members with class names.
  7. Annotations – A special type of interface used for annotating any program elements.

 
Downloading and Installing Java 5

 

Before you can start compiling and running Java programs, you need to download and install the JDK as well as configure some system environment variables. It is also recommended that you download the API documentation.

 

Downloading and Installing the JDK

 

The JDKs for Windows, Linux, and UNIX can be downloaded from this URL:

 

Once you click the link, you’ll be redirected to a page that lets you select an installation for your platform: Windows, Linux, or Unix. The 64 bit versions for certain platforms are available. Also, note that the same link also provides the JRE. However, you need the JDK, and the JDK includes the JRE.

 

For Macintosh, download the JDK from this URL:

 

After obtaining the JDK, you need to install it. Installation varies from one operating system to another.

 

Setting the Path Environment Variable on Windows

 

To set the PATH environment variable on Windows NT, Windows 2000, and Windows XP, do these steps:

 

1. Click Start, Settings, Control Panel.

2. Double-click System. on Windows NT, select the Environment tab. On Windows 2000 and Windows XP select the Advanced tab and then click on Environment Variables.

3.Locate the Path environment variable in the User Variables or System Variables panes.The value of Path is a series of directories separated by semicolons. Now, add the full path to the bin directory of your Java installation directory to the end of the existing value of Path.The directory looks something like:C:Program FilesJavajdk1.5.0_bin

 4.Click Set, OK, or Apply.

 

Leave a Reply