Open In App

CharArrayReader reset() method in Java with Examples

Last Updated : 13 Feb, 2019
Comments
Improve
Suggest changes
Like Article
Like
Report
The reset() method of CharArrayReader Class in Java is used to reset the stream. After reset, if the stream has been marked, then this method attempts to reposition it at the mark, else it will try to position it to the starting. Syntax:
public void reset()
Parameters: This method do not accepts any parameter. Return Value: This method do not returns any value. Exception: This method throws IOException:
  • if some error occurs while input output
  • if the stream has not been marked
  • if the mark has been invalidated
  • if the reset() method is not supported.
Below methods illustrates the working of reset() method: Program 1:
Output:
GeeksForGe
eks??
Program 2:
Output:
GeeksForGe
Geeks
Reference: https://docs.oracle.com/javase/9/docs/api/java/io/CharArrayReader.html#reset--

Next Article

Similar Reads