Hello folks :)
I have a program, and it contains a class which has a variable called number, so the line reads. Say that number means something to the program that makes something go 1 times. (not decided yet)
int number = 1;
I have a file called file.txt. What i'd like to be able to is put 'configuration' information in it.
So the first line of the text file will say. I don't know if there is also anyway that the program knows to only process the first line of code
number = 54;
And .. what i'd like to happen 'at runtime' is that the value for number change to 54 with in program (again at runtime - no recompiles)
In otherwords the value for number be configured at runtime (kind of like input from the console but this time from the file)
Is that possible. Any suggestions.
What if I wanted to add more lines in that txt file, that also lines of code.
So say the second line says.
System.out.println("This is today's quote of the day");
So somewhere in the code, it will say read the second line of code, insert here and run.
I assume we'd need some sort of method that reads, input from this file and then runs the block of code based on input. I assume it needs to process this as a string and paste it into the code on the fly.
I'm kinda stumped as I don't get how this would happen if the my source file hasn't re-compiled this data at runtime.