求解答,谢谢!改了半天还是有错
public class RectangleTest2 {public static void main(String[] args) {
Rectangle obj=new Rectangle(2,3);
System.out.println("举行的长和宽是:"+obj.length+","+obj.width);
int result=obj.area();
System.out.println("矩形的面积是:"+result);
}
}
class Rectangle()
{
int length=1,width=1;
public int area()
{
int temp=length*width;
return temp;
}
public Rectangle(int x,int y){
length=x;
width=y;
}
}