wood burning stoves*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Array reverse Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Array reverse" Watch "Array reverse" New topic
Author

Array reverse

michael micky
Greenhorn

Joined: May 31, 2011
Posts: 4
how to display an array in reverse using enhanced for loop?
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4344
    
    8

Hi Michael. Welcome to The Ranch!

If you want to use the enhanced loop, I think you'll need to reverse the order of the array first. The Collections class has a method for reversing a list: you could always convert it to a list and use that.

But personally, I'd just write an old-fashioned for loop and step backwards.
michael micky
Greenhorn

Joined: May 31, 2011
Posts: 4
well thnx Mr.Matthew Brown this is perfect......................
 
 
subject: Array reverse
 
Similar Threads
Base Converter
How to convert integer array to character array
WA #1.....word association
For Each Loop Doubt
array