The markSupported() method of BufferedReader class in Java is used to verify whether the stream supports the mark() method or not. It returns the boolean value true if the stream supports mark() otherwise it returns false.
public boolean markSupported()
Overrides: It overrides the markSupported() method of the Reader class.
Parameters: This method does not accept any parameter.
Return value: This method returns a boolean value indicating the supportability of the mark() method by the stream.
Exceptions: This method does not throw any exception.
Below programs illustrate markSupported() method in BufferedReader class in IO package:
Program 1: Assume the existence of the file “c:/demo.txt”.
Supports for mark() : true
Program 2: Assume the existence of the file “c:/demo.txt”.
Supports for mark() : 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.