DEV Community

Discussion on: A guide to Solid principles in java

Collapse
 
arpitmandliya profile image
arpitmandliya

Thank you for the good explaination.
Yes, Java prevents LSP violations while overriding the method. It does not allow you to change return type, however you can return instance of subtype also known as Covariant return type.