Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

import statement

 
Hilton Meyer
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

Just need a bit of an explanation. about the import statements of the Swing classes. Why do I have to include both

does the java.awt.*; not automatically add the event statement with the (*) the the end of the awt in the first line.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, it doesn't. Packages aren't hierarchical in Java - awt.event is *not* a subpackage of awt, but simply a different package, as far as the compiler is concerned.

Not a Swing question - moving to Java in General (beginner)...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic