I have make a hiscore but if I play a second game my hiscore from the first game is gone could somebody explain me how I can safe all the hiscores and not just one
To pernamently save data this requires a database. To save data that is being executed within the program you use datastructures. such as arrays integers variables lists etc etc. as for code that is really not needed. I dont know greenfoot well enough but you can have a replay game feature that makes it so it restarts the game while not leaving the JVM. That way you can store your Hi-Scores as long as you wish to play everytime you restart. But if you were to close the program then re-open it your scores would be deleted.
Look into databases compatible with greenfoot and then move on from there. Good luck i myself am learning databases soon aswell.