TAG:
用JAVAC编译时出现了上面的错误信息,实在没办法,请各位大侠帮忙。 我的程序如下: import java.io.PrintWriter; public class PointTest { public static void main(String[] args){ PrintWriter out=new PrintWriter(System.out,true); MyPoint mp = new MyPoint(4,3); Point2D p = new Point2D(11); Point2D q =mp; mp.x=5;mp.y=12; out.println("\\n\\tDataMember Access Test:\\n"); out.println("mp=("+mp.x+","+mp.y+")"); out.println("mp=("+p.x+","+p.y+")"); out.println("mp=("+q.x+","+q.y+")"); } public class Point2D { int x,y; Point2D(){ this(0,0); } Point2D(int x){ this(x,0); } Point2D(int x,int y) { this.x=x; this.y=y; } double length() { return Math.sqrt(x*x+y*y); } } public class MyPoint extends Point2D { int x,y; MyPoint(int x,int y) { super(x,y); this.x=x; this.y=y; } double length() { return Math.sqrt(x*x+y*y); } double distance() { return Math.abs(length()-super.length()); } } } (robotwin) |