Accessing class from different package in command line
<p>I have created two folders in C:\Users\Documents folder. I have named the folders as A and B. Inside folder A, I have written below java class. </p>

<pre><code>package A;

public class Food {
int a =6;
public int c = 10;
}
</code></pre>

<p>Inside folder B, I have below class written,</p>

<pre><code>package B;
import A.*;

public class Car {
 public static void main(String[] args) {
     Food food = new Food();
     System.out.println(food.c);         

 }
}
</code></pre>

<p>I am able to compile class Food from inside folder A. But when I am trying to compile class Car from inside folder B, I am getting below compilation error. How to resolve this?</p>

<pre><code>Car.java:2: error: package A does not exist
import A.*;
^
Car.java:6: error: cannot find symbol
     Food food = new Food();
     ^
symbol:   class Food
location: class Car
Car.java:6: error: cannot find symbol
     Food food = new Food();
                 ^
symbol:   class Food
location: class Car
3 errors
</code></pre>