Can a class that extends another class have a constructor code example
Example 1: constructor of class that extends another class
public class Vehicle {
private String regNo = null;
public Vehicle(String no) {
this.regNo = no;
}
}
Example 2: constructor of class that extends another class
public class Car extends Vehicle {
private String brand = null;
public Car(String br, String no) {
super(no);
this.brand = br;
}
}