public class Animal {
public Animal() { System.out.print("Animal"); }
public Animal(int age) { System.out.print("AnimalAge"); }
private boolean hasHorns() { return false; }
public static void main(String[] args) {
Animal animal = new Elk(5);
System.out.println("," + animal.hasHorns());
}
}
class Elk extends Animal {
public Elk(int age) {
System.out.print("Elk");
}
public boolean hasHorns() { return true; }
}
compiles and I dont understand the output
"Since there is no explicit call to the parent constructor, the default no-argument super() is inserted as the first line of the constructor"