This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi Wasim, I don't have a copy of the code but if by 'it is in the same directory' you mean the compiled class file is in the same directory as the class marked package B you will get a compile error. If you have two source files, one marked 'package A;' and another marked 'package B' your directory set up should be
You then need to compile from the 'root' directory using
Java expects the package naming to follow the directory structure. 'package A' instructs the compiler to look for the source file in the 'A' subdirectory. 'package B' instructs the compiler to look for the source file in the 'B' subdirectory. It searches for the subdirectories in the current directory. Hope that helps. ------------------ Jane Griscti Sun Certified Programmer for the Java� 2 Platform