import java.util.*;
public class MyRectangle
{
protected int length;
protected int width;
//
public MyRectangle(){};
public MyRectangle(int l,int w){length=l;width=w;};
//
public void setlength(int t){ length=t; }
public int getlength(){return length;}
//
public void setwidth(int t){ width=t; }
public int getwidth(){return width;}
public int getarea(){ return length*width ; }
//tostring
public String tostring(){ return "矩形"; }
}
import java.util.*;
public class MySquare extends MyRectangle
{
public MySquare(int l){length=width=l;}
public int getarea(){ return length*length; }
//tostring
public String tostring(){ return "正方形"; }
public static void main(String[] args)
{
MySquare a=new MySquare(3);
System.out.println("正方形的面积为"+a.getarea());
a.setlength(2);
System.out.println("正方形的面积为"+a.getarea());
}
}