Arguments

1.These are the values that are passed to the function when it's called.
2.They are the actual data that the function will use to perform its operations.
For example, in the function call add(5, 3), 5 and 3 are arguments.

int x = add(5, 3);
int y = sum(35, 47);

The values 5 and 3 are the arguments with which a method will be called by passing these values from another method.

Parameters

Each parameter consists of two parts: type name and variable name. A type name followed by a variable name defines the type of value that can be passed to a method when it is called.
Example 01

public int add(int a, int b)
{
   return (a + b);
}

The method add() has two parameters, named a and b with data type int. It adds the values passed in the parameters and returns the result to the method caller.
Example 02

void sum(int x, int y)

The sum() method has two parameters: x and y. While passing the argument values to the parameters, the order of parameters and number of parameters is very important. These must be in the same order as their respective parameters declared in the method declaration
Example 03

public static void main(String[] args)
{
   . . . . . . .
}

In the main() method, args is a string array parameter.

Interview Questions

  1. What is local variable?
    Local variables are defined within a specific block of code, such as a method or a loop, and are only accessible within that block.

  2. What is Parameter?
    Parameters are the variables that are listed as part of the method definition. They act like placeholders for the values that the method can accept.

  3. Can we change the Arguments name?
    yes we can change the Arguments name.

  4. What is method overloading?
    method overloading allows defining multiple methods with the same name but different parameters (number or type) within the same class, enabling flexibility and code readability.

*Key Concepts:
*

Same Name, Different Parameters:
Overloaded methods must have the same name but differ in their parameter lists (number, type, or order of parameters).

Compile-Time Polymorphism:
Method overloading is a form of compile-time polymorphism, where the compiler determines which method to call based on the arguments provided

05.What is Polymorphism?
In Java, polymorphism (meaning "many forms") allows objects of different classes to be treated as objects of a common type, enabling flexible and reusable code through mechanisms like method overriding and overloading