Reputation: 17
When I want to compile file named SetPoint.java there're errors:
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
I have this two files (Point.java and SetPoint.java) in folder named xyz. I don't know what I'm doing wrong. If I do the same in IntelliJ it works correctly.
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+")");
}
}
Upvotes: 2
Views: 88
Reputation: 201527
Compile both java files at the same time,
javac *.java
or
javac SetPoint.java Point.java
Upvotes: 3