Java Programming - Best way to save/read data for an application(Java 编程 - 为应用程序保存/读取数据的最佳方式)
问题描述
如果已经回答了这个问题,请原谅,但过去一个小时我一直在网上搜索以试图弄清楚.
Please forgive this quesiton if it has already been answered, but I have been searching online for the past hour to try to figure it out.
我正在努力重新开始 Java 编程,并且我正在尝试了解保存/读取我将存储在我的应用程序中的数据的最佳方式.我是否会将所有内容都放入一个文本文件并在应用程序启动时将其全部读取并在退出时将其全部保存?我认为如果应用程序太大,可能会占用太多内存?
I'm working on getting back into Java programming and I'm trying to understand the best way to save/read data I would be storing in my application. Would I put everything into a text file and read it all in when the application starts and save it all on exit? I figured that might eat up too much memory if the application was too large?
推荐答案
我想说,如果您需要存储少量信息,您可以使用属性文件.
I would say if you need to store few information you can use a properties file.
- 例如:http://www.mkyong.com/java/java-properties-file-examples/
如果您需要存储比属性更复杂的结构,我建议使用数据库(HSQL、Oracle、Mysql、MSSQL 等...).看你的需要.
If you need to store more complex structure than just properties I suggest using a database (HSQL, Oracle, Mysql, MSSQL, etc...). Depending of you needs.
- 例如:http://www.mkyong.com/tutorials/jdbc-tutorials/
这篇关于Java 编程 - 为应用程序保存/读取数据的最佳方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Java 编程 - 为应用程序保存/读取数据的最佳方式


- java.lang.IllegalStateException:Bean 名称“类别"的 BindingResult 和普通目标对象都不能用作请求属性 2022-01-01
- 在 Java 中,如何将 String 转换为 char 或将 char 转换 2022-01-01
- 如何使 JFrame 背景和 JPanel 透明且仅显示图像 2022-01-01
- 未找到/usr/local/lib 中的库 2022-01-01
- 如何指定 CORS 的响应标头? 2022-01-01
- GC_FOR_ALLOC 是否更“严重"?在调查内存使用情况时? 2022-01-01
- 获取数字的最后一位 2022-01-01
- Eclipse 的最佳 XML 编辑器 2022-01-01
- 转换 ldap 日期 2022-01-01
- 将 Java Swing 桌面应用程序国际化的最佳实践是什么? 2022-01-01