Passing array to a method.
please give some piece of code that will make me understand that how to pass an array to a method/function?
adil_bashir
Junior Poster in Training
67 posts since Jan 2012
Reputation Points: 3
Solved Threads: 1
exactly the same way you pass any other variable as a parameter
stultuske
Posting Sensei
3,137 posts since Jan 2007
Reputation Points: 1,114
Solved Threads: 433
please give some piece of code that will make me understand that how to pass an array to a method/function?
well lets say we want to parse an int[]:
private static method(int[] arr) {//static was used if necessarry
}
you'd then call it using:
int[] array=new int[5];
method(array);
DavidKroukamp
Practically a Master Poster
693 posts since Dec 2011
Reputation Points: 282
Solved Threads: 169
adil_bashir
Junior Poster in Training
67 posts since Jan 2012
Reputation Points: 3
Solved Threads: 1