0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

配列を返すメソッド-java

Last updated at Posted at 2019-10-28

配列を返すメソッド(例としてint型)

int[]addArray
public static int[] addArray(int x,int y) {
		int[] array = new int[2];
			array[0] = x;
			array[1] = y;
			return array;

addArrayメソッド内で配列を宣言する。
宣言した配列をreturnで返す。

int[]addArray
			int[] array = addArray(100,200);
			for(int all:array) {
			System.out.println(all);
		}

arrayの出力

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?