package com.company;
import java.util.Scanner;
public class Player {
boolean IsCompare=false;
double score;
String birth,address,sex,Groupname,age,id;
item1 i1;
item2 i2;
public boolean isCompare() {
return IsCompare;
}
public void setCompare(boolean compare) {
IsCompare = compare;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
Player(){
String[] s1=new String[6];
Scanner input=new Scanner(System.in);
System.out.println("input your age,id,birth,add,sex,groupname");
for (int i=0;i<6;i++){
s1[i]=input.next();
}
this.set(s1);
this.i2=new item2();
this.i1=new item1();
}
public item1 getI1() {
return i1;
}
public void setI1(item1 i1) {
this.i1 = i1;
}
public item2 getI2() {
return i2;
}
public String getGroupname() {
return Groupname;
}
public void setGroupname(String groupname) {
Groupname = groupname;
}
public double getScore() {
return score;
}
public void setScore(double score) {
this.score = score;
}
public void setI2(item2 i2) {
this.i2 = i2;
}
public void set(String[] s1){
this.age=s1[0];
this.id=s1[1];
this.birth=s1[2];
this.address=s1[3];
this.sex=s1[4];
this.Groupname=s1[5];
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Player)) return false;
Player player = (Player) o;
return id.equals(player.id);
}
@Override
public int hashCode() {
return id.hashCode();
}
}我有一个这样的类,想在主函数退出的时候把list的信息存入文件中,等下次调用主函数的时候再从文件中把list取出来放到内存中,求大神帮帮忙呀
添加回答
举报
0/150
提交
取消