广告
返回顶部
首页 > 资讯 > 精选 >java 对象输入输出流读写文件的操作实例
  • 694
分享到

java 对象输入输出流读写文件的操作实例

java 2023-05-31 08:05:35 694人浏览 薄情痞子
摘要

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文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作