Vinod Tiwari wrote:Thanks Campbell for clarification, I wanted to mean that only, the class under the package (n level) and classes are umported (only required one's) at complie time.
"import" is poorly named. It doesn't import anything -- it's just letting the compiler know what package names to use when resolving class names.
If you're using Eclipse, use the "Source | Organize Imports" option to automatically create imports for every class referenced in the source.
And... some people think it's bad style to use "*" to specify any class in a given package. The idea is that doing so (1) is less self-documenting (i.e., the reader can't just look at the imports to see a list of all classes), and (2) increases the possibility of referencing the wrong class (in case, coincidentally, the class name you are using happens to also exist in one of the classes in the *'d package).
Joined: Feb 06, 2008
Sorry Murali, I had a typo there and thanks to Max for clarifying.
I would be failing in my duties if I do not thanks Campbell who not only asked Murali to apologise (which he gently did) but also sent me a message to accept that, thanks Campbell a ton for this nice gesture of your's.
It's because of people like you that Javaranch is touching great heights, kudos to all.