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!

Help with reverse array

807601Feb 17 2008 — edited Feb 18 2008
I'm trying to print out the numbers that the user enters and then reprint them in reverse order but i can't even do the first part this is what i have so i could really use some help thanks
import java.util.*;
public class ReverseArray
   {
     
       public static void main(String[] args) 
      {
        int [] array = new int[10];  
        Scanner s = new Scanner (System.in);
        int num = 0;
        System.out.println("Enter numbers: ");
        num = s.nextInt();
        int i = 0;        
        for ( i = 0; i< array.length; i++)
            array[i] = num;
            System.out.print(array[i] + ", ");
        
        
      
      	
      }
   }
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 17 2008
Added on Feb 17 2008
32 comments
227 views