I am reading the book The Java Programming Language. In the chapter which explains overriding method, it says:
Making an override met
There is many principles that you should conform to when programming in java, or in any programming languages. The principles depend on the programming language you are using. You can know more about contract in Design by contract wikipedia page
It means that method overriding a method on a parent class or interface must behave in the way that the contract defines.
Otherwise the result is undefined.