Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
虽然我知道导入整个类可能会更好,但我仍然想知道如何从一个类中导入静态函数,这样我就可以在不使用类名的情况下调用它们。
具体来说,我正在尝试运行这个:
import java.lang.Math.pow;
这样我就可以打电话pow(2,3)而不是Math.pow(2,3)
pow(2,3)
Math.pow(2,3)
这显然给出了一个错误......有什么更合适的写法?