Java PrintStream.println(int x)
Syntax
PrintStream.println(int x) has the following syntax.
public void println(int x)
Example
In the following code shows how to use PrintStream.println(int x) method.
import java.io.*;
/*from www . ja va 2s.c o m*/
public class Main {
public static void main(String[] args) {
int c = 123;
PrintStream ps = new PrintStream(System.out);
// print an integer and change line
ps.println(c);
ps.print("from java2s.com");
// flush the stream
ps.flush();
}
}
The code above generates the following result.
Home »
Java Tutorial »
java.io »
Java Tutorial »
java.io »