English

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?
Chapter 6: Variables and Expressions - SHORT ASSIGNMENTS [Page 136]

APPEARS IN

Dheeraj Mehrotra Computer Science [English] Class 12
Chapter 6 Variables and Expressions
SHORT ASSIGNMENTS | Q 40. | Page 136
Advertisements
Share
Notifications



      Forgot password?
Use app×