Java, Programming Languages, Programming, Object Oriented.
void displayDetailsProtected() { // System.out.println("Mammal Name: " + getName() + ", " // + "Age: " + getAge() + // ", Has Fur: " + hasFur); // } Return type The method's return type in the subclass can be the same or a subtype of a parent class method. Let’s add this method to an Animal class: