There are several ways to print an output in java. We can use any of the following methods to print the output.
out : It is a reference of java.io.PrintStream object and it is also a static member of System class.
println : Prints in a new line.
print : Prints the output.
printf : It works as printf in C/C++.
public class printOutputSystem : It is a class in java.lang, the default package.
{
public static void main(String args[])
{
System.out.println("Hi");
System.out.print("Hello world!");
System.out.print("I am in print method");
}
}
out : It is a reference of java.io.PrintStream object and it is also a static member of System class.
println : Prints in a new line.
print : Prints the output.
printf : It works as printf in C/C++.
No comments:
Post a Comment