I've read several conflicting sources online about whether or not private methods can be overridden. What exactly is going on in this example then? Is method move being hidden?
class Animal {
private void move() {
System.out.println("Animals can move");
}
}
class Dog extends Animal {
public void move() {
System.out.println("Dogs can walk and run");
}
}
public class TestDog {
public static void main(String args[]) {
Dog b = new Dog(); // Dog reference and Dog object
b.move(); // runs the method in Dog class
}
}
https://docs.oracle.com/javase/specs/jls/se8/html/jls-8.html says that it's not technically overriding, so what is this called and will there be any unexpected behaviours?