Subclass constructors - Why must the default constructor exist for subclass constructors?

后端 未结 3 513
青春惊慌失措
青春惊慌失措 2020-12-18 09:05

Given a random class:

public class A {
    public T t;

    public A () {}  // <-- why is this constructor necessary for B?
    public A (T t) {
         


        
3条回答
  •  情话喂你
    2020-12-18 09:54

    If you don't make a call to a super constructor using super(i) as the first line of your constructor it will implicitly call the default super constructor

提交回复
热议问题