Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.InputStream;

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

        InputStream inStream = new FileInputStream("c:/test.txt");

        BufferedInputStream bis = new BufferedInputStream(inStream);

        // read until a single byte is available
        while (bis.available() > 0) {
            // read the byte and convert the integer to character
            char c = (char) bis.read();

            System.out.println(c);
        }
    }
}