Home  |   STIU  |   WOW  |   SCJP  |   SCDJWS   |   JEE FAQ  |   About US  |  

FAQ
  Java FAQ
  JSP FAQ
  Servlet FAQ
 

Advertisement

XyzWs Java FAQ:
How to import classes that are in the 'default' package?


Printer-friendly version Printer-friendly version | Send this 
article to a friend Mail this to a friend


Previous Next vertical dots separating previous/next from contents/index/pdf Contents
Advertisement
XyzWs Java FAQ : How to import classes that are in the 'default' package?

How to import classes that are in the 'default' package?


In JDK 1.4 it is not possible. You MUST put your classes in packages if you plan to import them. According to Incompatibilities Between Java 2 Platform, Standard Edition, v1.4.0 and v1.3:

The compiler now rejects import statements that import a type from the unnamed namespace. Previous versions of the compiler would accept such import declarations, even though they were arguably not allowed by the language (because the type name appearing in the import clause is not in scope). The specification is being clarified to state clearly that you cannot have a simple name in an import statement, nor can you import from the unnamed namespace.

To summarize, the syntax import SimpleName; is no longer legal. ....

 


Previous Next vertical dots separating previous/next from contents/index/pdf Contents

Support  | Feedback  | Help