This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Is there way to import static methods from a non-package class? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Is there way to import static methods from a non-package class?" Watch "Is there way to import static methods from a non-package class?" New topic
Author

Is there way to import static methods from a non-package class?

Zemian Deng
Greenhorn

Joined: Jun 12, 2007
Posts: 21
Hello,

I have a class that doesn't have package name(default to .) with many static methods. I can't seem to import these without hitting compiler error. The only solution I have is to add a package declaration to the class. Is there a way to do it without it?

I have the following:


Thanks,
Zemian Deng
Bill Shirley
Ranch Hand

Joined: Nov 08, 2007
Posts: 457
Java Spec, �7.5, Import Declarations

"It is a compile time error to import a type from the unnamed package."


Bill Shirley - bshirley - frazerbilt.com
if (Posts < 30) you.read( JavaRanchFAQ);
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Zemian Deng:
... The only solution I have is to add a package declaration to the class...

That's the way to do it.

Is there a reason that you want to use an unnamed package?


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is there way to import static methods from a non-package class?