0
Is there a way to store a variable in Java without losing it even after stopping the program without using files or databases ?
5 Respuestas
+ 2
Well if your exit code counts, then you can pass an exit code to the calling process which can forward it to the next. But what'd be the use case?
+ 2
If you end your program, the memory it's using gets deallocated. So for that purpose, no.
You could just store them in a file with encryption to stop users tampering, eg:
scores.dat
random data
#1 random data
#2 random data
random data #3 #4 random data
#5 random data
...then encrypt it. I assume tampering is the reason.
+ 1
i will try to do it with files
thanks Jamie
0
I want to store variables in my program as a scores of players and keep them stored and refer to it later and display there values
0
You can serialize classes and deserialize them later. That would be a more advanced topic though...