Some Interactive tips to take input form GUI Dialogs
import javax.swing.*;
class Dialog
{
public static void main(String[] args)
{
JOptionPane.showMessageDialog(null,"Enter the two numbers");
int x=Integer.parseInt(JOptionPane.showInputDialog("Enter first number"));
int y=Integer.parseInt(JOptionPane.showInputDialog("Enter second number"));
int z=x+y;
JOptionPane.showMessageDialog(null,"Sum : " + z);
}
}



class Dialog
{
public static void main(String[] args)
{
JOptionPane.showMessageDialog(null,"Enter the two numbers");
int x=Integer.parseInt(JOptionPane.showInputDialog("Enter first number"));
int y=Integer.parseInt(JOptionPane.showInputDialog("Enter second number"));
int z=x+y;
JOptionPane.showMessageDialog(null,"Sum : " + z);
}
}
Comments
Post a Comment