elementinputanddisplay.java

来自「《A first book of java》by Gary J.Bronson 」· Java 代码 · 共 21 行

JAVA
21
字号
import javax.swing.*;
public class ElementInputAndDisplay
{
  public static void main(String[] args)
  {
    final int NUMELS= 5;
    String s1;
    int i;
    int grade[];             // declare the array
    grade = new int[NUMELS]; // allocate the array
 
    for (i = 0; i < NUMELS; i++)    // Enter the grades
    {
      s1 = JOptionPane.showInputDialog("Enter a grade: ");
      grade[i] = Integer.parseInt(s1);
    }
    for (i = 0; i < NUMELS; i++)    // Print() the grades
      System.out.println("grade[" +i +"] is " + grade[i]);
    System.exit(0);
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?