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 = { 'H', 'E', 'L', 'L', 'O' };

        CharArrayReader car = new CharArrayReader(ch);

        int value = 0;

        // read till the end of the file
        while ((value = car.read()) != -1) {

            char c = (char) value;

            // print the character
            System.out.print(c + " : ");

            // print the integer
            System.out.println(value);
        }

    }
}