BufferedReader skip(long) method in Java with Examples Last Updated : 28 May, 2020 Comments Improve Suggest changes Like Article Like Report The skip() method of BufferedReader class in Java is used to skip characters in the stream. The number of characters to be skipped is passed as parameter in this method. Syntax: public long skip(long n) throws IOException Overrides: This method overrides skip() method of Reader class. Parameters: This method accepts one parameter i.e. n which represents the number of characters to be skipped. Return value: It returns the actual number of characters skipped by this method. Exceptions: IOException -This method throws IOException if an I/O error occurs. IllegalArgumentException - This method throws IllegalArgumentException if the value of n is negative./li> Below programs illustrate skip() method in BufferedReader class in IO package: Program 1: Assume the existence of the file "c:/demo.txt". Java // Java program to illustrate // BufferedReader skip() method import java.io.*; public class GFG { public static void main(String[] args) { // Read the stream 'demo.txt' // containing text "GEEKS" FileReader fileReader = new FileReader( "c:/demo.txt"); // Convert fileReader to // bufferedReader BufferedReader buffReader = new BufferedReader( fileReader); while (buffReader.ready()) { System.out.println( (char)buffReader.read()); // One character is to skipped buffReader.skip(1); } } } Input: Output: Program 2: Assume the existence of the file "c:/demo.txt". Java // Java program to illustrate // BufferedReader skip() method import java.io.*; public class GFG { public static void main(String[] args) { // Read the stream 'demo.txt' // containing text "GEEKSFORGEEKS" FileReader fileReader = new FileReader( "c:/demo.txt"); // Convert fileReader to // bufferedReader BufferedReader buffReader = new BufferedReader( fileReader); while (buffReader.ready()) { System.out.println( (char)buffReader.read()); // Two characters are to be skipped buffReader.skip(2); } } } Input: Output: References: https://docs.oracle.com/javase/10/docs/api/java/io/BufferedReader.html#skip(long) Comment More infoAdvertise with us P pp_pankaj Follow Improve Article Tags : Java Java-Functions Java-IO package Practice Tags : Java Explore BasicsIntroduction to Java4 min readJava Programming Basics9 min readJava Methods7 min readAccess Modifiers in Java6 min readArrays in Java9 min readJava Strings8 min readRegular Expressions in Java7 min readOOPs & InterfacesClasses and Objects in Java10 min readJava Constructors10 min readJava OOP(Object Oriented Programming) Concepts10 min readJava Packages7 min readJava Interface11 min readCollectionsCollections in Java12 min readCollections Class in Java13 min readCollection Interface in Java6 min readIterator in Java5 min readJava Comparator Interface6 min readException HandlingJava Exception Handling8 min readJava Try Catch Block4 min readJava final, finally and finalize4 min readChained Exceptions in Java3 min readNull Pointer Exception in Java5 min readException Handling with Method Overriding in Java4 min readJava AdvancedJava Multithreading Tutorial15+ min readSynchronization in Java10 min readFile Handling in Java5 min readJava Method References9 min readJava 8 Stream Tutorial15+ min readJava Networking15+ min readJDBC Tutorial12 min readJava Memory Management4 min readGarbage Collection in Java6 min readMemory Leaks in Java3 min readPractice JavaJava Interview Questions and Answers15+ min readJava Programs - Java Programming Examples8 min readJava Exercises - Basic to Advanced Java Practice Programs with Solutions7 min readJava Quiz | Level Up Your Java Skills1 min readTop 50 Java Project Ideas For Beginners and Advanced [Update 2025]15+ min read Like