且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从另一个java类调用静态方法

更新时间:2023-11-22 13:58:58

确保您有权访问B.staticMethod。也许声明为

Ensure you have proper access to B.staticMethod. Perhaps declare it as

public static String[] staticMethod() {
    //code
}

此外,您需要导入B类

import foo.bar.B; // use fully qualified path foo.bar.B

public class A {
    String[] lists = B.staticMethod();
}