Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Reverse array = possible?

843789Jun 30 2010 — edited Jul 3 2010
Hi guys,

I am learning the arrays these days, so far so good i must add (atleast that my rating of myself lol). Anyway, i was wondering if it is possible to have a reverse array? For example we have an array with 1,2,3 elements and we want to print it (or save it to another array) in order 3,2,1?

So far i thought of this (made a reverse for loop i think, dunno if i wrote it right?)

public class provim1 {
public static void main(String args[]){

int num[] = {1,2,3};

for(int i = num.length; i < 0; i--){

System.out.println(num);

}
}
}

I am getting nothing out of this and it's been bugging me today. Any help is appreciated.

Edited by: Eduu on Jun 30, 2010 11:54 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 31 2010
Added on Jun 30 2010
36 comments
915 views