public class CameraController {
private String basename = "base";
public CameraController() {
name();
}
public void name() {
System.out.println(basename);
}
static class sub extends CameraController {
private String basename = "sub";
public sub() {
name();
}
public void name() {
System.out.println(basename);
}
}
public static void main(String[] args) {
CameraController b = new sub();
}
}
猜猜结果是啥<br>
需要考虑重写,实例化顺序;<br>