5 Examples 1
5 Examples 1
In java, we use System.out.println() is the output statement to display a message, string or data on
the screen. It displays the argument that we pass to it.
As we know that we need to create the object of a class to invoke its method. Here instead of creating the
object of the PrintStream class we use System.out, it internally creates the object of PrintStream class so
we can use the statement System.out.println() to invoke println() method.
}
}
NOTE:- To Compile the above program we must set path and class path.
If there are no compilation errors in your program then java compiler creates one file i.e
First.class file(byte code) otherwise compiler displays compilation errors.
OUTPUT:-
//3)Arthimetical operations
class Arth
{
public static void main(String[] args)
{
int x=60;
int y=30;
System.out.println("Additon:"+(x+y));
}
}
OUTPUT: