954,549 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

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
Team Colleague
693 posts since Dec 2011
Reputation Points: 282
Solved Threads: 169
 

Thanks.

adil_bashir
Junior Poster in Training
67 posts since Jan 2012
Reputation Points: 3
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You