>>Can some shed some light on this for me?
I�ll try.
C:\Java\Exam\flora\Tree.java
C:\Java\Exam\flora\Forest2.java
Version 1. My current directory is C:\Java\Exam
C:\Java\Exam>javac flora\Forest2.java
C:\Java\Exam>
java flora.Forest2
The tree's age is 0
Version 2. My current directory is C:\Java\Exam\flora
C:\Java\Exam\flora>javac �classpath .. Forest2.java
C:\Java\Exam\flora>java -classpath .. flora.Forest2
The tree's age is 0
Two things I have to keeping reminding myself.
1. When executing the program, use the fully qualified name of the class flora.Forest2
2. When compiling and executing the program, set the classpath to the directory that contains the package directory flora.
----
>>I think it is because I am trying to put a class (Forest2) into the same package that I am trying to import from (Flora).
It is okay to import a public class from any package.
>>Is this a correct assumption?
No.
----
Figuring out how to use packages with javac and java can be frustrating. Don�t give up. Keep practicing. You need this skill to understand protected.
1. When compiling and executing the program, you can be in ANY directory anywhere. Set the classpath to contain the package directory.
2. When compiling, qualify the filename with directories if necessary, depending on your current directory. >javac dir\filename.java
3. When executing, always qualify the class name with the package name(s).
>java pkg.classname
[ June 20, 2004: Message edited by: Marlene Miller ]