java - Read all lines from a text file and save each to it's strings (without using List) -
i have text file game save java game (cookie clickers) stuff in file numbers without spaces. so:
10 20 30 40 50
i need read lines , save each 1 string.
so strings should this, can use them lot easier:
lives = 10 kills = 20 score = 30 ...
the saving code in class file (save.class). need code, other stuff should not problem.
is there kind of easy way make work want?
you can use scanner
follows:
scanner s = new scanner(new file("your file")); string lives = s.nextline(); string kills = s.nextline(); string score = s.nextline(); ... s.close();
Comments
Post a Comment