Presentation is loading. Please wait.

Presentation is loading. Please wait.

JAVA 1.5 New Features Dr V. The syntax of the enhanced for loop (for each) for (type variableName : arrayName) { statements } arrayName could be any.

Similar presentations


Presentation on theme: "JAVA 1.5 New Features Dr V. The syntax of the enhanced for loop (for each) for (type variableName : arrayName) { statements } arrayName could be any."— Presentation transcript:

1 JAVA 1.5 New Features Dr V

2

3

4 The syntax of the enhanced for loop (for each) for (type variableName : arrayName) { statements } arrayName could be any collection object name (LinkedList, ArrayList, etc.)

5 Generics The syntax for specifying the type of elements in a collection CollectionClass collectionName = new CollectionClass (); A statement that creates an array list of type String ArrayList codes = new ArrayList (); A statement that creates an array list of integers ArrayList numbers = new ArrayList (); Code that creates a linked list of type Product LinkedList products; products = new LinkedList ();

6 Formatted Output System.out.println(“$%.2f”, amt); Prints $326.75 for 326.7536 System.out.println(“%8.3f”, amt); Prints 326.753 for 326.7534


Download ppt "JAVA 1.5 New Features Dr V. The syntax of the enhanced for loop (for each) for (type variableName : arrayName) { statements } arrayName could be any."

Similar presentations


Ads by Google