Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Zemian Deng
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 457
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java Spec, �7.5, Import Declarations

"It is a compile time error to import a type from the unnamed package."
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic