Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

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

        int i;

        InputStream is = new FileInputStream("C://test.txt");

        while ((i = is.read()) != -1) {
            // converts int to char
            char c = (char) i;

            System.out.println("Character Read: " + c);

            // skip one byte
            is.skip(1);
        }
        is.close();
    }
}