Forums Register Login

Import statements

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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
Always look on the bright side of life. At least this ad is really tiny:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 554 times.
Similar Threads
Still wrestling with action listeners
HELP!!!!! java.lang.UnsatisfiedLinkError
ActionEvent Problem
Error Message
Error Message
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 22:37:45.