If you are talking about java-beans and NOT EJB Beans, then here is the explanation...
1. A JavaBean has a constructor that takes no arguments.
2. A JavaBean has a set of properties.
3. A JavaBean has accessor (getXxx, or isXxx for Boolean properties) methods and mutator methods (setXxx) that allow access to its underlying properties.
The 3rd point states a java class with private instance variables and public getter, setter.
eg:
import java.util.Date;
public class User {
private Date loginDate;
private String name;
private String password;
public User() { }
public Date getLoginDate() {
return loginDate;
}
public String getName() {
return name;
}
public String getPassword() {
return password;
}
public void setLoginDate(Date loginDate) {
this.loginDate = loginDate;
}
public void setName(String name) {
this.name = name;
}
public void setPassword(String password) {
this.password = password;
}
public void delete() {
// code to delete user from database
}
public void update() {
// code to update user in database
}
public static User getUser(String name) {
// code returning a new User object
// populated from the database
}
}