Turn System.out into a PrintWriter in Java
Description
The following code shows how to turn System.out into a PrintWriter.
Example
/*w w w .j a v a 2 s .c o m*/
import java.io.PrintWriter;
public class Main {
public static void main(String[] args) {
PrintWriter out = new PrintWriter(System.out, true);
out.println("Hello, world");
}
}
The code above generates the following result.