Hello I wrote a program that simulates a java quiz. the program has 3 nested classes first class asks for the user information(name id# etc) after all is provided a second class is called this class is the actual quiz the quiz ends when the user answers all the question or the time runs out at that point the third class scores the quiz. If the user fails he can press a button that allow him to take the quiz one more time. when the try again choice is selected a variable that keep track of tries is implemented by one. However, the problem is that the variable that keeps track of how many tries the user has taken gets wiped because the way i wrote the code the program starts all the way back from class 1 , then class 2 and class 3 and for some reason that variable goes back to its initial value when the class reloads the second time.
Is there a way i can save the variable so it does not get wiped?
Any help will be much appreciated.
Hello I wrote a program that simulates a java quiz. the program has 3
Share
I suggest to write value in a file so that when the class get reloaded it will read from there.