Description :

This java tutorial shows how to use the skip() method of BufferedReader class of package. This method returns how many characters has been skipped. This method override the skip() method of Reader Class.

Method Syntax :

public long skip(long n) throws IOException

Parameter Input :


DataType Parameter Description
long n It corresponds to the number of characters to skip


Method Returns :

This method simply returns how many characters were skipped.

Compatibility Version :

Requires Java 1.1 and up

Exception :


– the IllegalArgumentException will be thrown by skip() method if the argument n is negative


– IOException will be thrown if I/O error occurs

Discussion :

The BufferedReader skip() method takes an argument of long which signifies how many characters to be skip on the inputstream. This is used when we are caught in a scenario on which on reading characters on the input stream we want to omit character sequences.

Java Code Example :

This java example source code demonstrates the use of skip() method of BufferedReader class. Basically we read the user input from the console and then we skip 8 characters using the skip method. The readLine() method were used to print what is remaining on the input stream after 8 characters were skipped.



 * Java example source code that uses the skip() method of
 * BufferedReader class
 * This example java program reads a user input and 
 * then we skip a certain number of characters

public class BufferedReaderSkip {

	public static void main(String[] args) {
		System.out.print("Enter a sample string: ");
		// declare the BufferedReader Class
		// used the InputStreamReader to read the console input
		BufferedReader reader = new BufferedReader(new InputStreamReader(;

		// catch the possible IOException by the read() method
		try {
			// skip 8 characters on the input stream
			// print what is remaining on the input stream

			// close the BufferedReader object
		} catch (IOException e) {



Sample Output :

Running the skip() method example source code of BufferedReader class will give you the following output

Enter a sample string: BufferedReader skip method example
Output:Reader skip method example

Similar Method :

  • N/A

Suggested Reading List :

References :