这是一个非常简单的整数加法计算器程序,希望大家给些意见。
import Javax.swing.JOptionPane;
public class Addition {
public static void main (String args[]) {
String firstNum, secondNum;
int num1, num2, sum;
firstNum = JOptionPane.showInputDialog
("Enter first integer");
secondNum = JOptionPane.showInputDialog
("Enter secong integet");
num1 = Integer.parseInt(firstNum);
num2 = Integer.parseInt(secondNum);
sum = num1 + num2;
JOptionPane.showMessageDialog(
null,"The sum is "+ sum,
"Results",JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
} }