Hello Tharani,

At the top of your Food class source, you would have the package statement
specifying FoodPackage.Fruitpackage; this statement tells the Java compiler
to create a directory structure of Foodpackage/Fruitoackage, and place the
Food class inside the folder Fruitpackage.  When the class is compiled, the
directories are created for you. (You didn't have to create the folders
beforehand). That's the reason the Food class always compile without
problem.

Now when you create the source member for FoodMain.java, your current
directory is most likely at Fruitpackage.  Your FoodMain class tries to
import from Foodpackage,Fruitpackage package and use the methods defined in
Food class.  To compile the FoodMain class, your current directory must be
outside of these directories for the compiler to find it. (like at
myjavaprograms) . When you execute the javac command, you have to provide
the path for the compiler to find the FoodMain.java source.

 

HTH

norman


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Free 
Java Programming Online Training Course By Sang Shin" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to