Kulas_Code20

JOptionPane

Oct 18th, 2021
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.68 KB | None | 0 0
  1. import javax.swing.JOptionPane;
  2.  
  3. public class Mia_Michelle {
  4.     static public void main(String[] args) {
  5.        
  6.         //Get input from user using JOptionPane
  7.         int firstNum = Integer.parseInt(JOptionPane.showInputDialog("Enter first integer: "));
  8.         int secondNum = Integer.parseInt(JOptionPane.showInputDialog("Enter second integer: "));
  9.        
  10.         String message = "First integer inputted is "+firstNum+" and the second integer inputted is "+secondNum;
  11.         int sum = firstNum+secondNum;
  12.         JOptionPane.showMessageDialog(null, "First integer inputted is "+firstNum+" and the second integer inputted is "+secondNum);
  13.         JOptionPane.showMessageDialog(null, "The sum of two integer is: "+sum);
  14.        
  15.     }
  16. }
  17.  
Advertisement
Add Comment
Please, Sign In to add comment