please give some piece of code that will make me understand that how to pass an array to a method/function?

Recommended Answers

exactly the same way you pass any other variable as a parameter

Jump to Post

All 3 Replies

exactly the same way you pass any other variable as a parameter

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);

Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.