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

Recommended Answers

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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.