?? exercise5_2.java
字號:
import javax.swing.JOptionPane;public class Exercise5_2 { public static void main(String[] args) { // Prompt the user to enter the first number String numberString = JOptionPane.showInputDialog(null, "Enter an integer"); int max = Integer.parseInt(numberString); int count = 1; String inputNumbers = max + " "; // Prompt the user to enter the remaining five numbers for (int i = 1; i <= 5; i++) { numberString = JOptionPane.showInputDialog(null, "Enter an integer"); int temp = Integer.parseInt(numberString); inputNumbers += temp + " "; if (temp > max) { max = temp; count = 1; } else if (temp == max) count++; } JOptionPane.showMessageDialog(null, "The array is: " + inputNumbers + "\n" + "max is " + max + "\n" + "the occurrence count is " + count); System.exit(0); }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -