wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes importing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "importing" Watch "importing" New topic
Author

importing

Atrus Greyor
Ranch Hand

Joined: Mar 07, 2004
Posts: 110
do you have to import each section of the API indivdualy?
For example instead of:
import java.awt.*;
import java.lang.*;
couldn't you just do:
import java.*;
Thanks in advance!
Wai Hung
Greenhorn

Joined: Apr 15, 2004
Posts: 23
I don't think you can do that
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Despite appearances, a package x.y is not, in any meaningful sense, "part of" a package x. "import x" imports only classes directly in package "x", not those in "x.y". Since there actually are no classes in the "java" package, the answer is no, "import java.*" does nothing useful.


[Jess in Action][AskingGoodQuestions]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
I'm thinking that Ernest might have meant to say:
"import x.*" imports only classes directly in package "x", not those in "x.y"


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
walter kirsch
Greenhorn

Joined: May 10, 2004
Posts: 1
Then, will
import "java.*.*"
do the trick?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: importing