Discuss the various methods to pass parameters in a method.

bookmark

The various methods of passing parameters in a method include -

  • Output parameters: Lets the method return more than one value.
  • Value parameters: The formal value copies and stores the value of the actual argument, which enables the manipulation of the formal parameter without affecting the value of the actual parameter.
  • Reference parameters: The memory address of the actual parameter is stored in the formal argument, which means any change to the formal parameter would reflect on the actual argument too.