The mark() method of CharArrayReader Class in Java is used to mark the stream as the checkpoint from where the stream read will start, once reset() is called. This method is not supported by all subclasses of CharArrayReader class.
public void mark(int readAheadLimit)
Parameters: This method accepts a mandatory parameter readAheadLimit which is the limit on the number of characters that may be read while still preserving the mark. After reading this many characters, attempting to reset the stream may fail.
Return Value: This method do not returns any value.
Exception: This method throws IOException if some error occurs while input output or the mark() method is not supported.
Below methods illustrates the working of mark() 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. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.