I've trying to choose a specific line from file and I sort of got it, but I can't think of a way to change Strings or ints in console. For example there is a name and age: Tom 19 Jennifer 22
I choose line number 1 and I want to change something like, making Tom older, but i just can't figure it out, please help. Sorry for waisting your time if it's easy. Thank you.
    FileReader fr = null;
    LineNumberReader lnr = null;
    String str;
    int i;
    int currLine = 1;
    System.out.print("Which line to print?:  ");
    Scanner scan = new Scanner(System.in);
    int d = scan.nextInt();
    // create new reader
    fr = new FileReader("test.txt");
    lnr = new LineNumberReader(fr);
    // read lines till the end of the stream
    while ((str = lnr.readLine()) != null) {
        if (currLine == d) { // if current line number is 4, print
            // prints string
            System.out.println(str);
        }
        currLine++;
    }
    // closes the stream and releases system resources
    if (fr != null)
        fr.close();
    if (lnr != null)
        lnr.close();
}
 
     
     
    