I don't think they talked about the practical uses, though. There are several good reasons to use packages ...
1) To organize files on your source directories and in your head. On disk package are usually just folders, so we organize code in some way that makes sense to us just like we organize documents and pictures and other files.
2) To bundle up parts of the system with different characteristics. For example Robert Martin suggests we package abstract classes that don't change very often together, and concrete classes that change a lot together.
3) To set up units of deployment or distribution. If I have a neat utility I want to share with you, it's ideal if I can give you a jar with exactly the classes you need, no more and no less. Or if I have a big system I might want to update the user interface on my production server without touching the database accessors. We can set up packaging and jars just for that.
#2 and #3 can get a bit advanced for this forum, so don't sweat it if they didn't make much sense. Use #1 to organize code and get used to the mechanics of how to import and such. The other stuff will come when you need it.
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
Joined: Aug 02, 2006
i want to know that how to compile when package statement is there in a program.