您的位置:首页 > 运维架构

[20160704]Addition program that use JOptionPane for input and output

2016-07-04 21:57 585 查看
 1 //Addition program that use JOptionPane for input and output.

import javax.swing.JOptionPane;

public class Addition{
public static void main(String[] args) {
String firstNumber=JOptionPane.showInputDialog("Enter first integer!");

String secondNumber=JOptionPane.showInputDialog("Enter second integer!");

int num1=Integer.parseInt(firstNumber);
int num2=Integer.parseInt(secondNumber);

int sum=num1+num2;

JOptionPane.showMessageDialog(null,"The sum is:\t"+sum,"sum of two integers",JOptionPane.PLAIN_MESSAGE);

}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: