Created
February 20, 2019 18:32
-
-
Save tuxcuiabano/e584b0cdf5308151d16ac1100406342a to your computer and use it in GitHub Desktop.
Programa JOptionPane feito em sala de aula
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* To change this license header, choose License Headers in Project Properties. | |
* To change this template file, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package deitel14; | |
import javax.swing.JOptionPane; | |
/** | |
* | |
* @author tuxcuiabano | |
*/ | |
public class Adicao { | |
public static void main( String[] args ) | |
{ | |
String primeiroNumero = | |
JOptionPane.showInputDialog( "Digite o primeiro número" ); | |
String segundoNumero = | |
JOptionPane.showInputDialog( "Digite o segundo número" ); | |
int num1 = Integer.parseInt( primeiroNumero ); | |
int num2 = Integer.parseInt( segundoNumero ); | |
int sum = num1 + num2; | |
JOptionPane.showMessageDialog( null, "A soma é " + sum, | |
"Soma de dois Inteiros", JOptionPane.PLAIN_MESSAGE ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment