67,512
社区成员
发帖
与我相关
我的任务
分享
public class Point{
public void draw(Point p)
{System.out.println("Draw in Point");}
}
public class ColorPoint extends Point
{
public void draw (ColorPoint p)
{System.out.println("draw in ColorPoint");}
public static void main(String[] args )
{
Point p1=new Point();
Point p2=new ColorPoint();
ColorPoint p3=new ColorPoint();
p1.draw(p1);
p1.draw(p2);
p1.draw(p3);
p2.draw(p1);
p2.draw(p2);
p2.draw(p3);
p3.draw(p1);
p3.draw(p2);
p3.draw(p3);
}
}