Please give me a simple java code for addition of two numbers here two numbers are accepted
From users please give me explanation about each code
![]() |
Please give me a simple java code for addition of two numbers here two numbers are accepted
From users please give me explanation about each code
Instead of us doing your homework why don't you post some code that you've written and we'll be glad to help you with it.Quote:
Originally Posted by sankulanushkul
/ / Addition two numbers
import javax.swing.*;// this package call in JOptionPane
public class Addition
{ public static void main(String args[])
{
String fristNumber;
String secondNumber;
String result;
int number1;
int number2;
// Ask the user to input two number
firstNumber=JOptionPane.showInputDialog(''Enter first number'');
secondNumber=JOptionpane.showInputDialog(''Enter second number'');
// Methods below convert from string to int
number1=Integer.parseInt(firsNumber);
number2=Integer.parseInt(secondNumber);
// formule that make addition of two numbers
result=number1+number2;
JOptionPane.showMessageDialog(null, '' the addition of two number is''+result); // Message dialog that will show the addition of two numbers
}
}
I hope that this will help you !
****Naim****
All times are GMT -7. The time now is 10:12 PM. |