File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
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.
 
Don't get me started about those stupid light bulbs.
 
subject: Enhanced for loop in Java5