public class User implements Serializable{
public static final String FILENAME = "users.dat";
private String user_name;
private String user_psw;
public String getUser_name() {
return user_name;
}
public void setUser_name(String user_name) {
this.user_name = user_name;
}
public String getUser_psw() {
return user_psw;
}
public void setUser_psw(String user_psw) {
this.user_psw = user_psw;
}
public static ArrayList<User> getAllUsers(){
DataInputStream dis;
try {
dis = new DataInputStream(new FileInputStream(User.FILENAME));// 这里写this.FILENAME是不对的
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
……
}
}