[Solved] How to read from textfile in java? [closed]


What you want is to use a BufferedReader instance to read from the file, and parse each line that you get from it.

For example:

        try {
            BufferedReader reader = new BufferedReader(new FileReader("filename"));
            String line;
            while ((line = reader.readLine()) != null) {
                // parse your line here.
            }

            reader.close(); // don't forget to close the buffered reader

        } catch (IOException e) {
            // exception handling here
        }

And yes, the link given in the comments provide much more comprehensive answers.

solved How to read from textfile in java? [closed]