gk said:
what ? which one is not hierarchy ?
Packages in general.
i can save files here "com/pack1/packe2/pack3" folder with a package
statement "package com.pack1.packe2.pack3; " in all my java files.
This is just a convention used by most Java IDE's and standard class
loaders. But you should remember that packages != directories. You can
place your class files everywhere you like as long as you make sure they
are accessible via some class loader. Of course, there are some drawbacks
in putting all class files in a single directories (size and nameclashes
to name some).
What Roedy tried to convey is that there is no hiearchy of packages
although the dotted notation makes it look like there was. Packages are
just sitting beside each other. package com.foo.bar is not an inner
package to com.foo and has no provileged access to it.
i can save files here "com" folder with a package statement "package
com; " in all my java files.
but if i have a file with package statement "package com.pack1"
which of the following import work ?
import com.pack1.packe2.pack3.*;
import com.*;
None of them. You need
import com.pack1.*;
or
import com.pack1.YourClass;
i did not understand what do you mean by hierrarchy
Hope I could clear this up a bit.
Kind regards
robert