Welcome to the Ranch.
What folder are you running javac command. If your Car class is in a package and your BMW class is not then when you do
javac *.java
should only compile the one
java source in that directory.
Similar when you compile just the BMW class, it "should" able to look up or find its dependent class (eg Car) and compile that too.
Does your file structure looks like:
>BMW.java
>automob
|_Car.java
Try running the "javac BMW.java" command in the folder you have BMW.java