2

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+")");
    }

}
osxfloo
  • 17
  • 1
  • 8

1 Answers1

3

Compile both java files at the same time,

javac *.java

or

javac SetPoint.java Point.java
Elliott Frisch
  • 198,278
  • 20
  • 158
  • 249