• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

simple qs on import

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When we import a java.awt.*; all the class files and sub files of the packages are supposed to be imported.
Then why do we need to import java.awt.event.*; specifically for event handling.
Thanks in advance
Susmita
 
Ranch Hand
Posts: 269
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Susmita Pal:
When we import a java.awt.*; all the class files and sub files of the packages are supposed to be imported.


The JSR states in the package paragraph that
"A type-import-on-demand declaration (such as import java.lang. *) allows all public types declared in the package named by a fully qualified name to be imported as needed. "
There is no mention about subpackages. Anyway, imagine that you do not need to explicitely import subpackages but only the "father" package.
You would only have to put a "import java.*" at the top of your program to import, when needed, all the java classes! It would make your code unreadable.
W.


[This message has been edited by Wilfried LAURENT (edited October 15, 2001).]
 
Alas, poor Yorick, he knew this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic