Save below code as addition.java
CODE:
import javax.swing.JOptionPane;
public class addition
{
public static void main(String args[])
{
String n1,n2;
int n3,n4,sum;
n1=JOptionPane.showInputDialog("Enter first Number");
n2=JOptionPane.showInputDialog("Enter second number");
n3=Integer.parseInt(n1);
n4=Integer.parseInt(n2);
sum=n3+n4;
JOptionPane.showMessageDialog(null,"The sum is "+sum,"Result",JOptionPane.PLAIN_MESSAGE);
System.exit(0);
}
}
//End of program
Output:
To run this java program you should first install jdk(Java Development kit).
you can download it from here.
And also can download this java code and directly execute by simply clicking on .bat file in the rar file downloaded
Download here
Password for rar is:letuscodeit
Know about:
-JOptionPane
CODE:
import javax.swing.JOptionPane;
public class addition
{
public static void main(String args[])
{
String n1,n2;
int n3,n4,sum;
n1=JOptionPane.showInputDialog("Enter first Number");
n2=JOptionPane.showInputDialog("Enter second number");
n3=Integer.parseInt(n1);
n4=Integer.parseInt(n2);
sum=n3+n4;
JOptionPane.showMessageDialog(null,"The sum is "+sum,"Result",JOptionPane.PLAIN_MESSAGE);
System.exit(0);
}
}
//End of program
Output:
To run this java program you should first install jdk(Java Development kit).
you can download it from here.
And also can download this java code and directly execute by simply clicking on .bat file in the rar file downloaded
Download here
Password for rar is:letuscodeit
Know about:
-JOptionPane



No comments:
Post a Comment