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!

Display array in reverse

807598Feb 20 2006 — edited Feb 20 2006
how can display array in reverse?
package hello1;
import javax.swing.JOptionPane;
import javax.swing.JTextArea;
public class Untitled1 {


  public static void main(String args[]) {
    int ali[]=new int[6];
    int a;
    String value;

    for(a=0; a<6;a++){

      value=JOptionPane.showInputDialog("Please enter a number ");
     ali[a]=Integer.parseInt(value);

   }



   StringBuffer message = new StringBuffer("The arrayw was :");
for ( a=6; a>0; a) {
    message.append("\n ");
    message.append(ali[a]);
}
JOptionPane.showMessageDialog(null, message.toString());


    System.exit(0);

  }
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 20 2006
Added on Feb 20 2006
6 comments
137 views