This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
sumanth, Your name doesn't comply with the naming standards here at Javaranch. Check out this link for more info: www.javaranch.com/name.jsp Please re-register with a more appropriate name. Thanks, Bill
Joined: Jun 30, 2000
You classpath has to be setup so it knows where to find that package. Make sure your classpath includes the path to the package Flora. Bill
Hi Sumanth, In order for two files to be considered in the same package, you need to specify the exact same package line. In your Tree.java file you have specified the line: package Flora; But in your Forest.java you have not specified any package line. If you don't specify any package line then JVM uses default package. Therefore all files in same directory without package line in them will all be in the same package. To make your stuff work you can do 1 of 2 things. 1. Place line: package Flora; inside your file Forest.java. Your import line is then not required. 2. Place Tree.java inside directory named 'Flora', set your classpath correctly, and then it should work. Regards, Manfred.