+ 2

Passing array as parameter of function in java

if i define a function , it's parameter is an array , how to call this function and passing the elements of it's parameter ( the array)

11th Nov 2017, 6:04 PM
Mohammed Madian
Mohammed Madian - avatar
3 Answers
+ 13
Just an example code. Feel free to ask if you have any question :) https://code.sololearn.com/cNLa8bLsDOUy/?ref=app
11th Nov 2017, 6:16 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 7
Function(array);
11th Nov 2017, 6:14 PM
Vukan
Vukan - avatar
+ 3
public class Program { public static int[] x(int[] y){ return y; } public static void main(String[] args) { int[] m = new int[2]; m = x(m); } } Not that great of an example but...
11th Nov 2017, 6:16 PM
Marcus SĂžndergaard
Marcus SĂžndergaard - avatar