This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes package statement and import statement difference? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "package statement and import statement difference?" Watch "package statement and import statement difference?" New topic
Author

package statement and import statement difference?

Krystal Tyler
Greenhorn

Joined: Feb 03, 2002
Posts: 4
I am a beginner and I still can't rule out what is the difference between what a package statement does and an import statement.
Arun Boraiah
Ranch Hand

Joined: Nov 28, 2001
Posts: 233
hi,
I just want to give a example
package is just like a bag. Where you place items.
say you have placed some books, pen, pencil etc in a bag.
here books,pen,pencil are java code.
now even i have a bag with same/different items and assume both of our bags are placed next to each other.
A third party want to make use of your items. How do he refer's.
For that he calls your bag name with item he wants to use. for this to happen he uses "import" .
package is to define your bag name. And import is to use the content of the bag.
Hope this help. All the best
-arun


Sharing is learning
Krystal Tyler
Greenhorn

Joined: Feb 03, 2002
Posts: 4
Thank you for analogy. I understand now!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: package statement and import statement difference?
 
It's not a secret anymore!