Question d’entretien chez LTIMindtree

What is Polymorphism and its type?

Réponses aux questions d'entretien

Utilisateur anonyme

15 oct. 2024

Polymorphism is one of the fundamental principles of Object-Oriented Programming (OOP) and refers to the ability of different objects to respond to the same method or operation in different ways. The term "polymorphism" is derived from Greek, meaning "many forms." Types of Polymorphism Polymorphism is classified into two main types: Compile-time Polymorphism (Static Polymorphism): This type of polymorphism is resolved during compile time. It is achieved through method overloading or operator overloading (in some languages). Method Overloading: This occurs when multiple methods in the same class have the same name but different parameters (either by number, type, or both). The method to be called is determined by the compiler based on the arguments passed.Runtime Polymorphism (Dynamic Polymorphism): This type of polymorphism is resolved during runtime. It is achieved using method overriding, where a subclass provides a specific implementation of a method that is already defined in its superclass. The method to be executed is determined by the JVM at runtime based on the object type. Method Overriding: This happens when a subclass has a method with the same signature as a method in the superclass. The subclass version of the method is invoked at runtime.

1

Utilisateur anonyme

28 sept. 2024

Polymorphism is one of most important part of object orien ted programming.which allow method to exist in multiple forms. it applied to method. for example ,let's take a man driving a car the car driver can be a father ,brother , husband at a time There are two types of polymorphism Complie time and run time polymorphism

1

Utilisateur anonyme

1 oct. 2024

one task is performed in many(different) ways example: A person can play a role of husband ,son.