Memory: fast read and write, and the data is cleared after being cut;
Disk: Reading and writing are slow, and the data will not be cleared after being interrupted;
1. Write to memory: generally use HashMap, list or some cache frameworks, such as: (ehcache, memcache)
2. Write to disk: Generally, file output streams are used, such as:
The above article java writes data into memory and disk is all the content I share with you. I hope you can give you a reference and I hope you can support Wulin.com more.