import java.awt.*;
import java.lang.*;
 class Point implements Cloneable { //要实作Cloneable    public Object clone() throws CloneNotSupportedException {
        //呼叫父类别的clone()来进行复制
        return super.clone();
    }
}class Table implements Cloneable
{ //要实作Cloneable
  private Point center;
// … public Object clone()throws CloneNotSupportedException
           
{
//呼叫父类的clone()来复制
Table table = (Table)super.clone();
if (this.center != null)
{
//复制Point类型的数据成员
table.center = (Point)center.clone();
} return table;
}
//method 
public void setCenter(Point a)
{
center = a;

}
public Point getCenter()
{
return center;
}
public int getX()
{
return center.x;
}
public int getY()
{
return center.y;
}}
class Test
{
public static void main(String[] args)
{
Table table = new Table();
Point b =  new Point();
table.setCenter(b);
Point originalCenter = table.getCenter();
Table clonedTable = (Table)table.clone(); Point clonedCenter = clonedTable.getCenter();
System.out.printf("原来的Table中心:(%d, %d)\n",
   originalCenter.getX(), originalCenter.getY());
System.out.printf("复制的Table中心:(%d, %d)\n",
   clonedCenter.getX(), clonedCenter.getY());
clonedCenter.setX(10);
clonedCenter.setY(10);
//改变复制品的内容,对原来的对象不会有影响
System.out.printf("原来的Table中心:(%d, %d)\n",
   originalCenter.getX(), originalCenter.getY());
System.out.printf("复制的Table中心:(%d, %d)\n",
   clonedCenter.getX(), clonedCenter.getY());
}
}红体部分,为什么Point 对象center创建失败,编译时说找不到变量x.