What is an example of polymorphism in Java?

Polymorphism is one of the OOPs feature that allows us to perform a single action in different ways. For example, lets say we have a class Animal that has a method sound() . Since this is a generic class so we can’t give it a implementation like: Roar, Meow, Oink etc.

Sizin İçin Seçtik  How do you make a class non inheritable?

Leave a Reply

Your email address will not be published. Required fields are marked *

What is an example of polymorphism in Java?

Polymorphism is one of the OOPs feature that allows us to perform a single action in different ways. For example, lets say we have a class Animal that has a method sound() . Since this is a generic class so we can’t give it a implementation like: Roar, Meow, Oink etc.

Sizin İçin Seçtik  How many base classes are there in hierarchical inheritance?

Leave a Reply

Your email address will not be published. Required fields are marked *