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 situation?
public class Student {
private String name;
private int rollNum;
Student(String name,int rollNum){
super(); //I can not understand why super keyword here.
this.name=name;
this.rollNum=rollNum;
}
public static void main(String[] args) {
Student s1 = new Student("A",1);
Student s2 = new Student("A",1);
System.out.println(s1.equals(s2));
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…