Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Enhanced for loop in Java5

 
niranjan karkera
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Petrus Pelser
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you need the index, just use the old for loop.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic