当我想编译名为SetPoint.java的文件时,出现错误:
SetPoint.java:5: error: cannot find symbol
Point point = new Point();
^
symbol: class Point
location: class SetPoint
SetPoint.java:5: error: cannot find symbol
Point point = new Point();
^
symbol: class Point
location: class SetPoint
2 errors
我在名为xyz的文件夹中有这两个文件(Point.java和SetPoint.java)。我不知道自己做错了什么。如果我在IntelliJ中也这样做,它可以正常工作。
package xyz;
public class Point {
int coorX;
int coorY;
}
package xyz;
public class SetPoint {
public static void main(String args[]){
Point point = new Point();
point.coorX = 10;
point.coorY = 20;
System.out.println("Coordinate of point: ("+point.coorX+", "+point.coorY+")");
}
}
答案 0 :(得分:3)
同时编译两个java文件,
javac *.java
或强>
javac SetPoint.java Point.java