java 对象输入输出流读写文件的操作实例java 支持对对象的读写操作,所操作的对象必须实现Serializable接口。 实例代码:package vo; import java.io.Serializable; public cl
java 对象输入输出流读写文件的操作实例
java 支持对对象的读写操作,所操作的对象必须实现Serializable接口。
实例代码:
package vo; import java.io.Serializable; public class Animal implements Serializable { private static final long serialVersionUID = 1L; private String name; private Integer weight; private String color; private String type; private Integer age; private Integer lifetime; public String getName() { return name; } public void setName(String name) { this.name = name; } public Integer getWeight() { return weight; } public void setWeight(Integer weight) { this.weight = weight; } public String getColor() { return color; } public void setColor(String color) { this.color = color; } public String getType() { return type; } public void setType(String type) { this.type = type; } public Integer getAge() { return age; } public void setAge(Integer age) { this.age = age; } public Integer getLifetime() { return lifetime; } public void setLifetime(Integer lifetime) { this.lifetime = lifetime; } public Animal(String name, Integer weight, String color, String type, Integer age, Integer lifetime) { super(); this.name = name; this.weight = weight; this.color = color; this.type = type; this.age = age; this.lifetime = lifetime; } @Override public String toString() { return "Animal [name=" + name + ", weight=" + weight + ", color=" + color + ", type=" + type + ", age=" + age + ", lifetime=" + lifetime + "]"; } }
--结束END--
本文标题: java 对象输入输出流读写文件的操作实例
本文链接: https://www.lsjlt.com/news/224543.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-04-29
2024-04-29
2024-04-29
2024-04-29
2024-04-29
2024-04-29
2024-04-29
2024-04-29
2024-04-29
2024-04-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0