Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.FileReader;
import java.io.IOException;
import java.io.LineNumberReader;

public class Main {
    public static void main(String[] args) throws IOException {
        int i;
        // create new reader
        FileReader fr = new FileReader("C:/test.txt");
        LineNumberReader lnr = new LineNumberReader(fr);

        // read till the end of the stream
        while ((i = lnr.read()) != -1) {
            // skip one byte
            lnr.skip(1);

            // converts integer to char
            char c = (char) i;

            // prints char
            System.out.print(c);
        }
        lnr.close();
    }
}