相关疑难解决方法(0)

从静态方法调用超级方法

是否可以从子静态方法调用超静态方法?

我的意思是,以通用的方式,到目前为止,我有以下内容:

public class BaseController extends Controller {
    static void init() {
        //init stuff
    }
}

public class ChildController extends BaseController {
    static void init() {
        BaseController.loadState();
        // more init stuff
    }

}
Run Code Online (Sandbox Code Playgroud)

并且它有效,但我想以通用方式执行它,比如调用super.loadState(),这似乎不起作用......

java inheritance static super

23
推荐指数
2
解决办法
3万
查看次数

标签 统计

inheritance ×1

java ×1

static ×1

super ×1