127
java.io.PrintStream class
The PrintStream class provides methods to write data to another stream. The PrintStream class automatically flushes the data so there is no need to call flush() method. Moreover, its methods don’t throw IOException.
Commonly used methods of PrintStream class
There are many methods in PrintStream class. Let’s see commonly used methods of PrintStream class:
|
Example of java.io.PrintStream class
In this example, we are simply printing integer and string values. |
Example of printf() method of java.io.PrintStream class:
Let's see the simple example of printing integer value by format specifier. |
Output:10