Download presentation
Presentation is loading. Please wait.
1
JAVA 1.5 New Features Dr V
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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.