这是Point类:
public class Point {
private int x;
private int y; public Point() {
x = 0;
y = 0;
} public Point(int a, int b) {
x = a;
y = b;
} public void show() {
System.out.println("坐标的值为:(" + x + "," + y + ")");
}
}
}
这是Test类:public class Test {
public static void main( String args[] ) {
Point p1 = new Point();
p1.show();
Point p2 = new Point(3,5);
p2.show();
}
}
在Test类里new Point,javac的时候出错提示cannot resovle symbol,这是什么意思?
public class Point {
private int x;
private int y; public Point() {
x = 0;
y = 0;
} public Point(int a, int b) {
x = a;
y = b;
} public void show() {
System.out.println("坐标的值为:(" + x + "," + y + ")");
}
}
}
这是Test类:public class Test {
public static void main( String args[] ) {
Point p1 = new Point();
p1.show();
Point p2 = new Point(3,5);
p2.show();
}
}
在Test类里new Point,javac的时候出错提示cannot resovle symbol,这是什么意思?
你看一下你point类编译后的class的位置。
所以把".;"写在前面,就会先在本目录下找!
说得不太清楚.....