The setError() method of PrintWriter Class in Java is used to set the error state of this PrintWriter instance. This method is used as an indicator to indicate that an error has occurred in the stream. It is protected and hence needs to be implemented by deriving the PrintWriter class to use it.
protected void setError()
Parameters: This method do not accepts any parameter.
Return Value: This method do not return anything.
Below methods illustrates the working of setError() method:
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.