serialization ArrayList Java

感情迁移 提交于 2019-11-28 12:12:18
Ivaylo Petrov

If you want to use Serializable, you should have no problems, because ArrayList is Serializable just as String and every primitive type. public class Keyword implements Serializable {} should do. You can read more about this method here. However there are a lot of other options for serialization. So please be more specific.

Implement and Interface public class Keyword implements Serializable {} and Simply Use the method of "Object output stream" and "Object input stream" to Serialize and De-serialize the object.

and Arrylist can be Serialize as normal any data type can serialized.

inherit the serialization interface in the that class which calss object you want to serialize.

after that use the ObjectOutput for serialize the object and use the writeObject method for serialize the object.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!