简易加法计算器

发表于:2007-06-11来源:作者:点击数: 标签:
这是一个非常简单的整数加法计算器程序,希望大家给些意见。 import java x.swing.JOptionPane; public class Addition { public static void main (String args[]) { String firstNum, secondNum; int num1, num2, sum; firstNum = JOptionPane.showInputDia
这是一个非常简单的整数加法计算器程序,希望大家给些意见。

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);

} }

原文转自:http://www.ltesting.net

...