已知有两个JSP页面a.jsp和b.jsp。a.jsp页面提供一个表单,用户可以通过表单输入矩形的2个边长,

2025-01-03 02:38:30
推荐回答(2个)
回答1:

package tom;
public class mianJi {
int length=0,width=0,mianJi=0;
public void setLength(int n){
length=n;
}
public int getLength(){
return length;
}
public void setWidth(int n){
width=n;
}
public int getWidth(){
return width;
}
public void setMianJi(int a,int b){
length=a;
width=b;
mianJi=length*width;
}
public int getMianJi(){
return mianJi;
}

}

回答2:

int length=0,width=0,
float mianJi=0;
getLength..
set.....
getWidth...
setWidth....

getMianJi(){
this.length*this.width;
}
..............