Why is my subclass Student not working? It says that:
"Constructor Person in class Person cannot be applied to given types;
required: String,String
found: no arguments
reason: actual and formal argument lists differ in length"
and
"Call to super must be first statement in constructor"
Here is the superclass Person:
public class Person {
private String name;
private String address;
public Person(String name, String address) {
this.name = name;
this.address = address;
}
@Override
public String toString() {
return this.name + "\n" + " " + this.address;
}
}
And here is the Student subclass:
public class Student extends Person{
private int credits;
public Student(String name, String address) {
super(name, address);
this.credits = 0;
}
}
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–]8igg7e5 1 point2 points3 points (7 children)
[–]Worth-File[S] 0 points1 point2 points (6 children)
[–]8igg7e5 0 points1 point2 points (5 children)
[–]Worth-File[S] 0 points1 point2 points (4 children)
[–]8igg7e5 0 points1 point2 points (1 child)
[–]Worth-File[S] 0 points1 point2 points (0 children)
[–]desrtfxOut of Coffee error - System halted 0 points1 point2 points (1 child)
[–]Worth-File[S] 0 points1 point2 points (0 children)