PushbackReader reset() method in Java with Examples Last Updated : 11 Jul, 2025 Comments Improve Suggest changes Like Article Like Report The reset() method of PushbackReader Class in Java is used to reset the Stream. In the case of PushbackReader, this method always throws an exception as this method isn't supported by the PushbackReader. 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 always as the reset() method is not supported. Below methods illustrates the working of reset() method: Program 1: Java // Java program to demonstrate // PushbackReader reset() method import java.io.*; import java.util.*; class GFG { public static void main(String[] args) { try { // Initializing a StringReader // and PushbackReader String s = "GeeksForGeeks"; StringReader stringReader = new StringReader(s); PushbackReader pushbackReader = new PushbackReader(stringReader); // reset the stream position pushbackReader.reset(); // Close the stream using reset() pushbackReader.close(); System.out.println("Stream Closed."); } catch (Exception e) { System.out.println(e); } } } Output: java.io.IOException: mark/reset not supported Program 2: Java // Java program to demonstrate // PushbackReader reset() method import java.io.*; import java.util.*; class GFG { public static void main(String[] args) { try { // Initializing a StringReader // and PushbackReader String s = "GFG"; StringReader stringReader = new StringReader(s); PushbackReader pushbackReader = new PushbackReader(stringReader); // reset the stream position pushbackReader.reset(); // Close the stream pushbackReader.close(); System.out.println("Stream Closed."); } catch (Exception e) { System.out.println(e); } } } Output: java.io.IOException: mark/reset not supported Reference: https://docs.oracle.com/javase/9/docs/api/java/io/PushbackReader.html#reset-- Comment More infoAdvertise with us Next Article PushbackReader read() method in Java with Examples S srinam Follow Improve Article Tags : Java Java-Functions Java-IO package Java-PushbackReader Practice Tags : Java Similar Reads PushbackReader read() method in Java with Examples The read() method of PushbackReader Class in Java is used to read a single character from the stream. This method blocks the stream till: It has taken some input from the stream. Some IOException has occurred It has reached the end of the stream while reading. Syntax: public int read() Parameters: T 3 min read PushbackReader read() method in Java with Examples The read() method of PushbackReader Class in Java is used to read a single character from the stream. This method blocks the stream till: It has taken some input from the stream. Some IOException has occurred It has reached the end of the stream while reading. Syntax: public int read() Parameters: T 3 min read PushbackReader read() method in Java with Examples The read() method of PushbackReader Class in Java is used to read a single character from the stream. This method blocks the stream till: It has taken some input from the stream. Some IOException has occurred It has reached the end of the stream while reading. Syntax: public int read() Parameters: T 3 min read PushbackReader ready() method in Java with Examples The ready() method of PushbackReader Class in Java is used to check whether this PushbackReader is ready to be read or not. It returns a boolean which states if the reader is ready. Syntax: public void ready() Parameters: This method does not accepts any parameters Return Value: This method returns 2 min read PushbackReader ready() method in Java with Examples The ready() method of PushbackReader Class in Java is used to check whether this PushbackReader is ready to be read or not. It returns a boolean which states if the reader is ready. Syntax: public void ready() Parameters: This method does not accepts any parameters Return Value: This method returns 2 min read PushbackReader ready() method in Java with Examples The ready() method of PushbackReader Class in Java is used to check whether this PushbackReader is ready to be read or not. It returns a boolean which states if the reader is ready. Syntax: public void ready() Parameters: This method does not accepts any parameters Return Value: This method returns 2 min read Like