Cannot find symbol class Java

247 Views Asked by At
package com.test;

public class Main {
    public static void main(String[] args) {
        Car car = new Car();
        System.out.println("Car speed: " + car.speed);
    }
}


package com.test;

public class Car {
    public int speed = 100;
}

Main.java:5: error: cannot find symbol
        Car car = new Car();
        ^
  symbol:   class Car
  location: class Main
Main.java:5: error: cannot find symbol
        Car car = new Car();
                  ^
  symbol:   class Car
  location: class Main
2 errors

In console i coming in folder package, there all java files Main.java and Car.java And do first in console javac Car.java
Next i do javac Main.java, it writes error

I`m coding in IntelliJ IDEA, everything works fine there

0

There are 0 best solutions below