This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Importing Classes in default package 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 » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Importing Classes in default package" Watch "Importing Classes in default package" New topic
Author

Importing Classes in default package

swarna dasa
Ranch Hand

Joined: Mar 15, 2007
Posts: 108
Is there a way to import classes in default package (having no package statement at all)?

Have a file
Test.java

public class Test {
}

Have another file Test2 in package com

package com;
public class Test2 {
public static void main(String[] args) {
//Test test = new Test();
}
}

Is there any way of importing Test.java?
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
No you cannot import them unless they are in a package.

As long as the directory containing the .class file is in the CLASSPATH, you should be able to use the type.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Importing Classes in default package