Using the following code:
public class Animal {
public void a() {
System.out.println("Animal");
}
}
public class Cat extends Animal {
public void a() {
System.out.println("Cat");
}
}
public class BlackCat extends Cat {
public static void main(String[] args) {
BlackCat blackCat = new BlackCat();
blackCat.a();
}
}
How to use in child class BlackCat
method a()
from Animal
but not from Cat
?
I want to receive Animal
in console.