answersLogoWhite

0

import javax.swing.JOptionPane;

public class Addition

{

public static void main( String args[] )

{

String firstNumber =

JOptionPane.showInputDialog( "Enter first integer" );

String secondNumber =

JOptionPane.showInputDialog( "Enter second integer" );

int number1 = Integer.parseInt( firstNumber );

int number2 = Integer.parseInt( secondNumber );

int sum = number1 + number2;

JOptionPane.showMessageDialog( null, "The sum is " + sum,

"Sum of Two Integers", JOptionPane.PLAIN_MESSAGE );

}

}

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

What program to add two Complex numbers in java?

I found this class that defines complex numbers, and has the capacity of adding them, and much more: http://www.math.ksu.edu/~bennett/jomacg/c.html Basically, you define a class with two fields, one for the real part, and one for the imaginary part.


Java applet program to accept two numbers in text field and add two numbers?

package AddNumbers; public class AddNumbers { public static void main(String[] args) { int Int; int a = 4; int b=5 ; int sum = a + b; System.out.println("Addition of two numbers!"); System.out.println("Sum: " + sum); } }


What does the plus in java mean?

It is used for addition - to add two numbers. Also, to concatenate two Strings (texts) - that is, to make a longer text from two shorter ones.


Can a java program has two different variable?

Yes. You can have as many variables as you want in Java


Write a program to add two 8 bit numbers in microprocessor 8051?

write it in 8085


Write a java program of addition of two variables?

public class AddNumbers{ public int add(int a, int b){ return a + b; } }


What is all of the Fibonacci numbers in nature?

Its indefinite: Start with 0,1 add last two numbers = 1 add to sequence = 0,1,1 add last two numbers = 2 add to sequence = 0,1,1,2 add last two numbers = 3 add to sequence = 0,1,1,2,3 add last two numbers = 5 add to sequence = 0,1,1,2,3,5 add last two numbers ......... add to sequence ..........


How do you write java program to times a number?

Java, like many other programming languages, uses the asterisk for the multiplication operator. Therefore, two numbers a and b are multiplied, and their product assigned to a variable r, with this construct: r = a * b;


How can a GUI of a program to add subtract multiply and divide the two numbers look like?

Take a look at the Windows Calculator.


How do you input an operator between two numbers in java?

You type it in with your keyboard.


What does add operator do?

Add two numbers.


What numbers must you add to make an even number?

You must add either two odd numbers or two even numbers.