📄 account.java
字号:
public class Account {
String firstName;
String lastName;
final String ACCOUNT_DATA_FILE = "AccountData.txt";
public Account(String fname, String lname) {
firstName = fname;
lastName = lname;
}
public boolean isValid() {
/*
Let's go with simpler validation
here to keep the example simpler.
*/
if (getLastName().trim().length() < 6)
return false;
return true;
}
public boolean save() {
FileUtil futil = new FileUtil();
String dataLine = getFirstName() + "," + getLastName();
return futil.writeToFile(ACCOUNT_DATA_FILE, dataLine,
true, true);
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -