I've solved it, thank you for the loop sugestion.
for (int i = 0; i < list.size(); i++)
writer.write(list.get(i) + "\r\n");
writer.close();
Type: Posts; User: JGW
I've solved it, thank you for the loop sugestion.
for (int i = 0; i < list.size(); i++)
writer.write(list.get(i) + "\r\n");
writer.close();
Sorry yes my ArrayList, if I write a loop that gets each element it will just overwrite the file each time it loops so I will end up with a file that just has the last element in it. Or is there a...
The text file has several lines,
a
b
c
d
The code runs through each line until it finds what it is looking for, what the user entered, whilst it is doing this it adds the lines into an array....
I have a text file that includes [a, b, c, d], when this program is run it adds the elements to an array and allows the user to replace an element.
For example if a user replaces "d" with "e" the...
I have now edited my thread to include my whole program
Sorry I've changed my method of saving now. Ignore this thread
I have an array [a, b, c, d] that I wish to save to a .txt file. My code allows a user to edit a specific line of text file as it deletes the rest of the files contents on edit I have decided to...
I want to create a program that will replace some of the text within a text file, however when I attempt to do so it deletes the rest of the file so I'm left with just the replaced line.
For...
What do you mean by "the array must be defined at the class level" I'm a beginner in Java.
So basically I have an array saved in class, I then have a separate class which brings up a form. I wish to use this form to search within the array, i later want to work with the array to edit it. ...