super keyword without extends to the super class

后端 未结 3 657
执笔经年
执笔经年 2020-12-03 23:09

There is a code of simple program. In constructor, super() is called without extends to the super class, I can not understand what will does this in this situat

3条回答
  •  不思量自难忘°
    2020-12-03 23:41

    Constructor from your code works the same as:

    Student(String name, int rollNum){
        this.name = name;
        this.rollNum = rollNum;
    }
    

    In your question super() is just calling constructor of Object class.

提交回复
热议问题