File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes about packages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "about packages" Watch "about packages" New topic
Author

about packages

srikanth arroju
Ranch Hand

Joined: Aug 02, 2006
Posts: 66
please explain the concept of packages with a program
Scott Johnson
Ranch Hand

Joined: Aug 24, 2005
Posts: 518
Take a look at this Wikipedia article.
[ August 19, 2006: Message edited by: Scott Johnson ]
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Darn, that Wikipedia guy is pretty smart!

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
srikanth arroju
Ranch Hand

Joined: Aug 02, 2006
Posts: 66
i want to know that how to compile when package statement is
there in a program.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13868
    
  10

See Lesson: Packages in The Java Tutorial.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: about packages
 
Similar Threads
HOw to solve this problem?
difference betwwn package & interfaces?
Java Packages
java unable to recognize class where my IDE does
Java Packages