According to the definitions I found on the Internet, a JavaBean is a Java class that satisfies the following conditions:
- All instance attributes are private.
- All instance attributes have public receivers and setters
- The class has a constructor without parameters
- The class implements the Serializable interface.
What I would like to know is that if I add a method to Javabean, can we call it javabean?
As an example, you can say that the next class is a JavaBean?
public class Person implements Serializable {
private String name;
public Person(){}
public String getName(){...}
public void setName(String name){...}
public void sayHello(){}
}
source
share