Forums Register Login

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

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
Java Spec, �7.5, Import Declarations

"It is a compile time error to import a type from the unnamed package."
+Pie Number of slices to send: Send
 

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?
Have you no shame? Have you no decency? Have you no tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 760 times.
Similar Threads
Most specific method.......
what is "null"
Whats wrong with this code
Class cast on Object Array
The "toString()" method.
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 18:29:44.