成都创新互联网站制作重庆分公司

java对象输入输出流读写文件的操作实例-创新互联

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 + "]"; 
  } 
   
} 


本文题目:java对象输入输出流读写文件的操作实例-创新互联
转载来源:http://cxhlcq.com/article/dcheps.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部