Addition of Two Number Program in Java || Write a Program to Print Addition of Two Number
Hello
friends, in this article I am discussing the some java code which are useful
for you or any person and programmer.
The
code will be vey simple and run in very less time interval, here all codes is
running on the all platform like – One Compiler, IDE for JAVA and some other
platforms are available on the internet.
Q 2.) Write a
Program for Print the Addition of two number.
class Add
{
public static
void main (String args[])
{
int a=10;
int b=20;
int c;
c=a+b;
System.out.println(“Addition
of Two Number is ” c);
}
}
Here Output is :-
30
Here staring the class Add which is main class which
contains the main function, then open the curly brackets then closed at last.
So again we are use main function and open bracket
and close the curly brackets.
And then we are use System.out.println() for
printing Addition of two numbers.