Polymorphism in Java - Dr D Adhimuga Sivasakthi

Описание к видео Polymorphism in Java - Dr D Adhimuga Sivasakthi

Welcome to this lecture on Polymorphism in Java.

Polymorphism is a fundamental concept in Java's object-oriented programming (OOP) that allows objects of different classes to be treated as objects of a common parent class. It's a core concept in OOP that allows for tasks to be executed in different ways.

There are two ways to achieve polymorphism in java
1. Compile-time Polymorphism - through Overloading
2. Runtime Polymorphism - through Overriding

Process in which a function call to the overridden method is resolved at Runtime - Method Overriding Derived class has a definition for one of the member functions of the base
Class to provide its own implementation. That, base function is said to be overridden

Advantages of Polymorphism :

Increases code reusability by allowing objects of different classes to be treated as objects of a common class.

Improves readability and maintainability of code by reducing the amount of code that needs to be written and maintained.

Supports dynamic binding, enabling the correct method to be called at runtime, based on the actual class of the object.

Enables objects to be treated as a single type, making it easier to write generic code that can handle objects of different types.

Disadvantages of Polymorphism :

Can make it more difficult to understand the behavior of an object, especially if the code is complex
May lead to performance issues, as polymorphic behavior may require additional computations at runtime

#sist #sathyabama #oops #extends #polymorphism #java #polymorphismjava #types #javastaticpolymorphism #javadynamicpolymorphism #overloading #overloadingvsoverriding #advantagesofpolymorphism #disadvantagesofpolymorphism

Комментарии

Информация по комментариям в разработке