Reader Skip() Example

Skips characters.


Skips characters. Reader class Skip() method example. This example shows you how to use Skip() method.This method Skips characters.

Here is the code:-

/**
 * @Program that Skips characters.
 * Skip.java 
 * Author:-RoseIndia Team
 * Date:-5-jun-2008
 */
import java.io.*;

public class Skip {

    public static void main(String[] argsthrows IOException {
        // Create a new StringReader.
        String s = "Roseindia";
        StringReader r = new StringReader(s);
        for (int i = 0; i < s.length(); i++) {
            if (r.ready()) {
                // Reads a single character.
                char charRead = (charr.read();
                System.out.println(charRead);
                //  Skips characters.
                long l=r.skip(1);
                System.out.println(l);
                
            else {
                break;
            }
        }
r.close();
    }
}

Output of the Program
 R
1
s
1
i
1
d
1
a
0
?
0
?
0
?
0
?
0

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US