0
Does Java's ArrayList store data at runtime only?
2 ответов
+ 4
Yes. The data is lost, deleted from memory after the program finished running.
Saving the data for future use, can be done separately, you can search the topics of "persistence" and "serialisation" to learn more.
Data can be saved into a file or in a database for example, and next time your program can read it from the same location when starting up.
+ 3
As I understood, any instance of any class, including whatever data they may be carrying, will be destroyed once the program is terminated (end of run-time).
The only way to achieve data persistence, was to write them into file, stored in disk or other storage media.