Formal and actual arguments

Overview

The argument is There are the terms formal and actual arguments.

Formal argument

It is written in the place where the function is defined Called side

Actual argument

It is written where the function is called Caller

There is a difference.

public static int add(int x,int y){//1 Formal argument
   return x + y;
}

public static void main(String[]args){
  int x = 10;
  int y = 20;
  add(x,y);//2 Actual argument
}
  1. Define that you do this with the formal argument.
  2. Actually call and use with actual argument.

https://qiita.com/hp_kj/items/9ffe03bf2919c99b964a In the comment section, I was told about the arguments. I investigated and summarized it.

Recommended Posts

Formal and actual arguments
[Java] Arguments and parameters
GraphQL Ruby and actual development
Java arguments, return values and overloads