r/programmingrequests • u/Assassin739 • Mar 20 '19
solved [Request] Java code that will parse each line of a .txt into an integer variable
E.g. the text document might say :
Var1
Var2
Var3
And this code would convert the file into three integers, Var1, Var2 and Var3. The amount needs to be adjustable so other people can modify it and add their own variables.
Code to check in case one of the variables is already in use isn't necessary.
0
Upvotes
2
u/POGtastic Mar 28 '19
You're looking for a
HashMap. Typically, you'd have a hardcoded config file that specifies defaults, and then the user's config file can have just a couple of changed settings.The game opens its default config files to set the initial settings, and then it opens any mod config files to overwrite those settings.
1
u/DFTBAman Mar 20 '19
I'm pretty sure what you're asking for isn't really possible in Java...