aspose file tools*
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 Spring in Action this week in the Spring 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: 4421
    
    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......................
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Array reverse