Taking input from a text file line by line : <p>I have a text file in which the data is mentioned as below. </p>

<p>3<br>
4<br>
5<br>
6</p>

<p>Now i want to make a function in which i first take the value <strong>3</strong> and then make another function in which i need the value <strong>4</strong>. </p>

<p>I have this code which reads the file line by line. But my question is how should access the integers in each line and then store it in any variable so that i can use it in my function?      </p>

<pre><code>  try {

        File f = new File("src/txt.txt");

        BufferedReader b = new BufferedReader(new FileReader(f));

        String readLine = "";

        System.out.println("Reading file using Buffered Reader");

        while ((readLine = b.readLine()) != null) {


            System.out.println(readLine);


        }

    } catch (IOException e) {
        e.printStackTrace();
    }
</code></pre>
