Call of the parent class constructor in Java
class Man {
public String name;
public Man(String name) {
this.name = name;
}
}
class Employee extends Man {
public String position;
public Employee(String name, String position) {
super(name);
this.position = position;
}
}
Employee employee = new Employee("Max", "booker");
- Log in to post comments