addition of two numbers in java using method
Answers
Answered by
2
double a=Double.parseDouble(jTextField1.getText());
double b=Double.parseDouble(jTextField2.getText());
double c=a+b;
jTextField3.setText(" "+c);
double b=Double.parseDouble(jTextField2.getText());
double c=a+b;
jTextField3.setText(" "+c);
Answered by
1
Answer:
import java.io.*;
class Main {
public static void main(String[] args)
{
// Declaring variable
int num1 = 10, num2 = 20, sum;
// Printing the variables
System.out.print("The sum of ");
System.out.println(
num1 + " and " + num2 + " is:");
// Printing the result after operation
System.out.println(num1 + num2);
}
}
Similar questions