I understood, I think, that a \"Bean\" is a Java class with properties and getters/setters. As much as I understand, it is the equivalent of a C struct. Is that true?
<
A Java Bean is any java class that satisfies the following three criteria:
Good to note the serialVersionUID field is important for maintaining object state. Below code qualifies as a bean:
public class DataDog implements java.io.Serializable {
private static final long serialVersionUID = -3774654564564563L;
private int id;
private String nameOfDog;
//The constructor should NOT have arguments
public DataDog () {}
/** 4. getter/setter */
// getter(s)
public int getId() {
return id;
}
public String getNameOfDog() {
return nameOfDog;
}
// setter(s)
public void setId(int id) {
this.id = id;
}
public void setNameOfDog(String nameOfDog) {
this.nameOfDog = nameOfDog;
}}