If I have a a textfile say file.txt and it contains random words like:
fruit:apple
fruit:orange
fruit:grape
In java, if i wanted to change the second line to read fruit:pear
how could i do it?
I know how to append onto the end of a txt file like so:
BufferedWriter wrtr = new BufferedWriter(new FileWriter(file.txt, true));
wrtr.write("blahblah"); //appends
but this is not what i want, i just want to be able to edit a string in the file in a certain position. any ideas?