So what I want to do is keep a variable like for example which level has been unlocked and not reset it whenever the program is restarted. I first thought about making Greenfoot write the variables in a text file but I had no luck with that. Are there any ways I can keep variables after restarting the game?
Take for example 3 levels
boolean levelOneUnlocked = true;
boolean levelTwoUnlocked = false;
boolean levelThreeUnlocked = false;
Now if the player beats level one, I want to unlock level two. However if I were to restart Greenfoot, the variable would be reset back to false. Is there any way I can prevent that?

