小编Yoz*_*n22的帖子

没有Superclass调用super()?

当构造函数调用'super()'而没有除Object之外的任何超类时会发生什么(如果有的话)?像这样:

public class foo implements Serializable, Comparable {

  int[] startPoint;

  public foo() {

    super();

    startPoint = {5,9};
  }
}
Run Code Online (Sandbox Code Playgroud)

编辑:所以如果这样做什么都没有,为什么有人会在代码中明确地写出来?如果我删除该行会有什么不同吗?

java inheritance constructor

5
推荐指数
3
解决办法
4279
查看次数

标签 统计

constructor ×1

inheritance ×1

java ×1