저는 사용자 프로필 클래스가 있으며,로드하는 가장 좋은 방법은 무엇인지 궁금합니다. 나는 다음과 같은 코드를 가지고 그것을 할 수있는 적절한 방법이 될 것인지 알고 싶었어요. 데이터베이스에서 프로필 가져 오기 - Java
UserProfile userProfile = null;
char[] password = {'a','b','c'};
for(UserProfile profile : UserProfiles){
if(compareUserNameAndPassword("userName", password)){
userProfile = profile;
}
}
그리고 내 프로필 클래스 :
package jlibfprint;
public class UserProfile extends Profile {
/**
* constructor
*/
public UserProfile(String userName, int id, char[] password){
this.name = userName;
this.id = id;
this.password = password;
}
/**
* Users password
*/
private char[] password;
/**
* Set User password
* @param password
*/
public void setPassword(char[] password){
this.password = password;
}
/**
* compare passwords
*/
public boolean compareUserNameAndPassword(String userName,char[] password) {
if(this.name.equals(userName) && this.password.equals(password)){
return true;
}
return false;
}
}
로드로 무엇을 의미합니까? – unholysampler
당신은 무엇을 가장 잘 의미합니까? –
코드가 컴파일되지 않습니다. –