can i keep arrays in parameters of method | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

can i keep arrays in parameters of method

11th Apr 2017, 9:55 AM
shobhit
shobhit - avatar
3 Answers
+ 18
Sure you can :) The following method takes an int array as parameter and prints all elements of it. public static void printArray(int[] arr) { for(int i=0; i<arr.length; i++){ System.out.println(arr[i]); } }
11th Apr 2017, 10:25 AM
Shamima Yasmin
Shamima Yasmin - avatar
+ 7
You can use both multidimensional array and jagged array as your parameters. :)
11th Apr 2017, 10:51 AM
Cyrus Ornob Corraya
Cyrus Ornob Corraya - avatar
0
. I. w,
12th Apr 2017, 8:28 AM
Nishanth