How are method parameters initialized in Java?
Advertisements
Question
How are method parameters initialized in Java?
Short Answer
Advertisements
Solution
- In Java, method parameters are initialized automatically with the values of the arguments passed to the method when it is called. These values are assigned to the corresponding parameters in the order in which they are declared.
- Method parameters act as local variables and receive their initial values during the method call. Unlike instance and static variables, method parameters do not receive default values.
Thus, method parameters are initialized through the arguments supplied by the calling method.
shaalaa.com
Is there an error in this question or solution?
