Advertisement
Java_Volume1 Input/ Output #99225

simple array

Simple code to do a simple thing.....Allows user to enter 10 number and puts those numbers into a number array, the prints it back to the user in reverse.

AI

Resumo por IA: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Código fonte
original-source
import javax.swing.JOptionPane;
public class NumArray
{
 public static void main(String[] args)
 {
  String A;
  int x = 0;
  System.out.println();
  System.out.println("Loading the array with  values going forward");
  System.out.println();
  int[] Num1 = new int[10];
  for (int i = 0; i <=9;i++){
  A = JOptionPane.showInputDialog(null,"Please Enter A Whole Number","Enter A Number",JOptionPane.INFORMATION_MESSAGE);
  x = Integer.parseInt(A);
  System.out.println(x);
  Num1[i]=x;
  x = 0;
 }
 System.out.println();
 System.out.println("Your array going in reverse");
 System.out.println();
 
  for (int i = 9; i >= 0; i--){
  System.out.println(Num1[i]);
  }
 }
}
Comentários originais (3)
Recuperado do Wayback Machine