save changes (permanently) in an arraylist?

前端 未结 4 1956
北荒
北荒 2021-01-27 06:25

Is that possible? Like for example, a user added a new item/element into the arraylist (bufferedreader process) and surely, there would be changes happen. My question is that is

4条回答
  •  孤城傲影
    2021-01-27 07:22

    The arraylist object you work with is just a variable of your program. While your program keeps a reference to this variable, but once you close the program the variable will disapear. If you want to keep the information inside of the variable you need to use a file or a database, you cannot store a java variable.

提交回复
热议问题