码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2016-07-04 23:26:31      阅读:138      评论:0      收藏:0      [点我收藏+]

标签:

 1 //Addition program that use JOptionPane for input and output.
 2 
 3 import javax.swing.JOptionPane;
 4 
 5 public class Addition{
 6    public static void main(String[] args) {
 7      String firstNumber=JOptionPane.showInputDialog("Enter first integer!");
 8 
 9      String secondNumber=JOptionPane.showInputDialog("Enter second integer!");
10 
11      int num1=Integer.parseInt(firstNumber);
12      int num2=Integer.parseInt(secondNumber);
13 
14      int sum=num1+num2;
15 
16      JOptionPane.showMessageDialog(null,"The sum is:\t"+sum,"sum of two integers",JOptionPane.PLAIN_MESSAGE);
17 
18    }
19 }

 

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

标签:

原文地址:http://www.cnblogs.com/jasonzeng888/p/5641835.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!