LoginSignup
6
4

More than 1 year has passed since last update.

仮引数と実引数

Last updated at Posted at 2018-09-02

概要

引数には
仮引数と実引数という言葉があります。

仮引数

関数を定義しているところに書いてある
呼び出される側

実引数

関数を呼び出しているところに書いてある
呼び出す側

という違いがあります。

public static int add(int x,int y){//1 仮引数
   return x + y;
}

public static void main(String[]args){
  int x = 10;
  int y = 20;
  add(x,y);//2 実引数
}
  1. 仮引数でこういうことをするよ、というのを定義しておきます。
  2. 実引数で実際に呼び出して使用します。

https://qiita.com/hp_kj/items/9ffe03bf2919c99b964a
コメント欄にて、引数について教えていただいたきました。
調べてまとめました。

6
4
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
4