Hi ... An extension to this
Thread ... Just thought would summarize the two important steps that are to be followed when creating packages! So that, I make it clear to those people, who find it hard with packages and also to clear myself
Say I have the package "food" created under "c:\java", meaning my Fruit.java, Apple.java, Fruit.class, Apple.class are under the folder c:\java\food.
I have the file Trade.java in the folder c:\java. Now, the two important steps are:
1. APPEND to your CLASSPATH, c:\java
2. use "import food.*;" in your Trade.java
When Trade.java is compiled, compiler comes to the "import food.*;" statement. It then takes each and every path from CLASSPATH one by one, and appends "food" to it and checks, whether it is a valid directory. If yes, then looks for classes Apple and Fruit inside it. If right files are found, it gives no compilation error.
Hope I made it clear! Thanks!