壹個javabean就相當於壹個數據模型,舉個例子,Student類就可以當做壹個數據模型類,也就是javabean,這個數據模型類壹般只包構造方法,屬性,以及這些屬性的set和get方法,下面我給妳壹個例子:
public?class?Student{
private?String?name;
private?int?age;
private?int?hight;
/**
*?構造方法 */public?Student(String?name,?int?age,?int?hight)
{
this.name?=?name;
this.age?=?age;
this.hight?=?hight;
}
public?String?getName()
{
return?name;
}
public?void?setName(String?name)
{
this.name?=?name;
}
public?int?getAge()
{
return?age;
}
public?void?setAge(int?age)
{
this.age?=?age;
}
public?int?getHight()
{
return?hight;
}
public?void?setHight(int?hight)
{
this.hight?=?hight;
}
} 希望可以幫助到妳,有什麽疑問都可以追問,望采納,謝謝!