aspose file tools*
The moose likes Beginning Java and the fly likes Import statements 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 "Import statements" Watch "Import statements" New topic
Author

Import statements

chris czinder
Greenhorn

Joined: Oct 02, 2002
Posts: 28
Now I understand that import statements are important and what not, but my question is why if I have already done this

I need this

to make the following program work

It seems odd, that if I've already included java.awt.* that it would include java.awt.event.*
Just wondering
thanks,
Chris
Joe Pluta
Ranch Hand

Joined: Jun 23, 2003
Posts: 1376
I thought the same thing, Chris, but as it turns out, imports are not recursive. That is, they do not automatically include "subpackages". In fact, there is no such thing as a subpackage. The name java.awt.event has nothing to do with java.awt. For each package you wish to specify, yuou must specify the complete package name.
It's kind of like specifying a path in DOS, or a classpath in Java. If you specify /myfolder/mystuff, it will not automatically look in /myfolder/mystuff/myotherstuff.
Joe
chris czinder
Greenhorn

Joined: Oct 02, 2002
Posts: 28
Thanks a lot, that clears it up. I had just naturally figured that it would/should be recursive.
Should know better then to just assume anything in the computer world is as it should be
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Import statements
 
Similar Threads
ActionEvent Problem
Error Message
Error Message
HELP!!!!! java.lang.UnsatisfiedLinkError
Still wrestling with action listeners