Java语言编写,出现 “找不到符号”
正确代码:
class Rectangle
{
int width, height;
int getLength( )
{ return (width + height) * 2;}
void getArea( )
{ System.out.println(“面积为:”+width*height); }
}
class Test
{
public static void main(String[]args)
{
Rectangle rect1=new Rectangle();
//Rectangle rect2=new Rectangle();
rect1.width=10;
rect1.height=20;
int length=rect1.getLength();
System.out.println(“周长:”+length);
//System.out.println(“周长=”+rect1.getLength);
rect1.getArea();
}
}