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. ....
Most Recent java Faqs
- How to uncompress a file in the gzip format?
- How to make a gzip file in Java?
- How to use Java String.split method to split a string by dot?
- How to validate URL in Java?
- How to schedule a job in Java?
- How to return the content in the correct encoding from a servlet?
- What is the difference between JDK and JRE?
Most Viewed java Faqs
- How to read input from console (keyboard) in Java?
- What are class variables in Java?
- How to Retrieve Multiple Result Sets from a Stored Procedure in JDBC?
- How to Use Updatable ResultSet in JDBC?
- What are local variables in Java?
- How to Use JDBC Java to Create Table?
- Why final variable in Enhanced for Loop does not act final?