The concept of polymorphism in Java allows us to carry out a single action in various ways. Compile-time polymorphism and runtime polymorphism are the two types of polymorphism used in Java.
Recursion is the process of a function repeatedly invoking itself. There is no need for a looping statement to be executed in the recursion method. With the help of this technique, complex problems can be reduced to more manageable, simpler ones.
Variable arguments are abbreviated as “varargs.” An argument of a method in Java can take any number of values. Varargs is the name of this argument, which can accept a variable number of values.
When a function is called in Java, a value is passed to the function as an argument. While a parameter is a variable that is used to define a specific value when defining a function.
Method overriding is a term used in Java when a subclass (child class) has a method that is also declared in the parent class. A method used by Java to achieve Run Time Polymorphism is method overriding.
Method overloading is the practice of having multiple methods with the same name but various parameter values. Compile-time polymorphism is connected to overloading.
Method overloading can be done in two different ways.
Different argument datatypes
Various number of arguments
A method is a self-contained block of statements or a sub-program of one or more statements that performs a special task when it is called. We can directly pass data in a method called parameters as a passing value. In Java, methods are used to perform certain specific actions and they are also known as functions.