Don't forget to mark this topic as solved by changing the topic title to "[SOLVED] loading things from a text file into an array list" ^____^
Type: Posts; User: dpek
Don't forget to mark this topic as solved by changing the topic title to "[SOLVED] loading things from a text file into an array list" ^____^
There is, but you don't need to, since the last comma is ignored when you load the file.
I'm guessing you've never seen foreach loops before and you don't know what .split() does.
.split...
I'm sorry, but I'm not quite sure what you're trying to say here.
If you want to convert "a,b,c" to an array [a,b,c], so that the list of elements are put in the array correctly, the try block of...
However, in your save.java class, you are doing this:
try {
PrintWriter save = new PrintWriter(new FileWriter("save.txt"));
save.print(player.inventory + " ");
save.close();
}
Which...
Try using savedInv.next() instead of savedInv.nextLine()