Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.CharArrayReader;

public class Main {
    public static void main(String[] args) throws Exception {

        char[] ch = { 'A', 'B', 'C', 'D', 'E' };

        CharArrayReader car = new CharArrayReader(ch);

        int value = 0;

        // read till the end of the stream
        while ((value = car.read()) != -1) {
            // convert integer to char
            char c = (char) value;

            // print characters
            System.out.print(c + "; ");

            // skip single character
            long l = car.skip(1);
            System.out.println("Characters Skipped : " + l);
        }
    }
}