Java program adding two number using variable and without variable
In this java program , two numbers directly give print function then added, second method create variable gives the number then add
A java program to add two integer number
class Add{
public static void main(String a[])
{
System.out.println(10+20);//without variable creation
System.out.println();
int num1=10;//num1 is variable, int data type, 10 value
int num2=20;//integer number 20 assigne variable num2
System.out.println(num1+num2);//adding two number with variable creation
}
}
A java program to add two integer number using eclipse IDE
observe the program and its output carefully
Comments
Post a Comment