Saturday, March 13, 2010

GUI INPUT

GUI INPUT

import javax.swing.*;

public class Guiinput
{
public static void main(String args[])
{
int a,b,c;
String r,s;
r = JOptionPane.showInputDialog("Enter First Number: ");
a = Integer.parseInt(r);
s = JOptionPane.showInputDialog("Enter Second Number: ");
b = Integer.parseInt(s);
c=a+b;
JOptionPane.showMessageDialog(null,"The Sum of "+a+" and "+b+" is: "+c);
}
}



No comments:

Post a Comment