The
reset() method of
StringReader 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:
Program 2: