"packages prevent name collisions because each package creates a class namespace".:-taken from a training manual on java
I understand the concept of deviding the classes into seperate packages where one class can have the identical name to another class as long as it is sourced in a different directory.I wonder if someone could describe what is meant by creating a "class namespace".I realise this probably means a seperation of the classes into different packages but hopefully someone could just confirm this for me . thankyou in advance
an island in the sun <br />with a language of many tongue?
posted 10 years ago
You got it. Packages have several uses. One is just to organize code so it's easier to manage than a zillion classes in one folder. For that purpose, packages are pretty much just namespaces. They mirror a directory structure on disk so you can have the same name in two packages just as you would in two folders.
Packages also play a role in design by managing visibility and scope of some classes. And you can think of a package as a unit of deployment, though that usually turns out to be a larger "component" than just a package.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi