{{theTime}}

Search This Blog

Total Pageviews

Java1.5 features:


Static Imports:
Eg: import static java.math.* ; all the methods in math class can be used without the class name. For eg: abs(12.2).
Enhanced For loop
: Eg: Vector country = new Vector();
for( String s: country ) S.O.P(s);

Generics Eg: Vector veh = new Vector(); Vehicle ve = veh.get(0);

AutoBoxing: Eliminates manual conversion between Primitive types & wrapper types.
You can add int to a collection directly.
Eg: Integer i = 10 ;

import java.util.*;

// Prints a frequency table of the words on the command line
public class Frequency {
public static void main(String[] args) {
Map m = new TreeMap();
for (String word : args) {
Integer freq = m.get(word);
m.put(word, (freq == null ? 1 : freq + 1));
}
System.out.println(m);
}
}

java Frequency it it if it if
{ if=3, it=2 }

Metadata: Annotations in a program itself. For eg: for java beans bean.info is required, for EJB is descriptor is required. Annotations can be used to eliminate the support files.
Enums Enumerated Types with attribute methods.
public Enum Rank {FIRST,SECOND,THIRD}

Refer http://java.sun.com/j2se/1.5.0/docs/relnotes/features.html#varargs for more details

No comments:

Generate Insert Sql from Select Statement

SELECT 'INSERT INTO ReferenceTable (ID, Name) VALUES (' +        CAST(ID AS NVARCHAR) + ', ''' + Name + ''...