PrintStream clearError() method in Java with Examples
The clearError() method of PrintStream Class in Java is used to clear the error state of this PrintStream instance. It clears any error that might have or not happened in the stream. Hence the checkError() method will always return false after this method.
protected void clearError()
Parameters: This method do not accepts any parameter.
Return Value: This method do not returns any value.
Below methods illustrates the working of clearError() method:
GeeksForGeeks Has any error occurred: false
A Has any error occurred: false
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. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.