|--需求说明
1、自动注册一堆会员账号并保存为本地文件
2、关闭程序,载入本地文件,可以用注册出来的会员账号及密码登录
|--实现方式
1、使用随机的方式生成会员信息
2、使用ObjectOutputStream和ObjectInputStream 对会员信息进行保存和读取
|--代码内容


1 package cn.save; 2 3 import java.io.Serializable; 4 5 /** 6 * @auther::9527 7 * @Description: 用户类 8 * @program: shi_yong 9 * @create: 2019-08-02 15:45 10 */ 11 public class User implements Serializable { 12 private String name; 13 private String cardId; 14 private String phoneNum; 15 private String passWord; 16 17 public User() { 18 } 19 20 public User(String name, String cardId, String phoneNum, String passWord) { 21 this.name = name; 22 this.cardId = cardId; 23 this.phoneNum = phoneNum; 24 this.passWord = passWord; 25 } 26 27 public String getName() { 28 return name; 29 } 30 31 public void setName(String name) { 32 this.name = name; 33 } 34 35 public String getCardId() { 36 return cardId; 37 } 38 39 public void setCardId(String cardId) { 40 this.cardId = cardId; 41 } 42 43 public String getPhoneNum() { 44 return phoneNum; 45 } 46 47 public void setPhoneNum(String phoneNum) { 48 this.phoneNum = phoneNum; 49 } 50 51 public String getPassWord() { 52 return passWord; 53 } 54 55 public void setPassWord(String passWord) { 56 this.passWord = passWord; 57 }