aspose file tools*
The moose likes Beginning Java and the fly likes Enhanced for loop in Java5 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Enhanced for loop in Java5" Watch "Enhanced for loop in Java5" New topic
Author

Enhanced for loop in Java5

niranjan karkera
Greenhorn

Joined: Feb 06, 2008
Posts: 1
for(int e: a[])
//print the value of e

is there any approach to get the index value of array
(eg: in the earlier version of for loop we could retrieve the index i value)
Sheikh Sadiruddin
Greenhorn

Joined: Aug 10, 2007
Posts: 21


SCJP 6 (80%) || SCWCD 5 (92%)
Petrus Pelser
Ranch Hand

Joined: Feb 20, 2006
Posts: 132
If you need the index, just use the old for loop.
 
 
subject: Enhanced for loop in Java5