Java BufferedReader skip() method example

HQ ┬╗ Java Tutorial ┬╗ ┬╗ BufferedReader ┬╗ skip() method example
Java BufferedReader skip() method example 2018-02-16T07:27:50+00:00 skip()

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.

Sample Output :

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

Similar Method :

  • N/A

Suggested Reading List :

References :

Contact Info


Our Goal

JavaTutorialHQ aims to to be The Ultimate Guide on Java with hundreds of examples from basic to advance Topics.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.