?? customer.java
字號:
package fangsoft.testcenter.model;
import fangsoft.testcenter.model.Profile;
public class Customer {
private static Customer[] customers;
public static String[][] CUSTOMER_DATA={
{
"bill",//name
"fangsoft",//password
"fangsoft.org@gmail.com",//email
"china","beijing","beijing","beijing",//address
"100081",//postcode
"13910797448"//phone
},
{
"fangsoft",
"fangsoft",
"fangsoft.java@gmail.com",
"china","peking","peking","peking",
"100081",
"13910797448"
}
};
private String name;
static{
int size=CUSTOMER_DATA.length;
customers=new Customer[size];
for(int i=0;i<size;i++){
String[] cust=CUSTOMER_DATA[i];
Customer c=new Customer();
Profile p=new Profile(cust[2],cust[1]);
c.setProfile(p);
c.setName(cust[0]);
customers[i]=c;
}
}
private Profile profile;
public Profile getProfile() {
return profile;
}
public void setProfile(Profile profile) {
this.profile = profile;
}
public static boolean login(String userId,String password){
for(int i=0;i<customers.length;i++){
Profile p=customers[i].getProfile();
if(p.getUserId().equals(userId) &&
p.getPassword().equals(password)){
return true;
}
}
return false;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -