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 {

        FileReader fr = new FileReader("C:/test.txt");
        LineNumberReader lnr = new LineNumberReader(fr);

        // sets the current line number
        lnr.setLineNumber(100);

        // get the current line number
        int i = lnr.getLineNumber();

        // print the current line number
        System.out.print("Current line number: " + i);
        lnr.close();
    }

}