File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 24166
    
  30

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
 
Similar Threads
a question about exceptions
I want clear explanation,Plz explain
interface again
Overloading Constructors
classpath issue