PrintWriter.checkError() has the following syntax.
public boolean checkError()
In the following code shows how to use PrintWriter.checkError() method.
import java.io.*; //from ww w . j a va2 s .c o m public class Main { public static void main(String[] args) { String s = "tutorial from java2s.com "; PrintWriter pw = new PrintWriter(System.out); // append the sequence pw.append(s); // check if there is an error and flush System.out.println("" + pw.checkError()); } }
The code above generates the following result.