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);

        // set current line number
        lnr.setLineNumber(100);
        System.out.println("setLineNumber(100) is invoked");

        // get current line number
        int i = lnr.getLineNumber();
        System.out.print("Current line number: " + i);
        lnr.close();
    }
}