About 3,680,000 results
Open links in new tab
  1. Java Method Call Array - Stack Overflow

    Oct 17, 2014 · How do I pass an array from my main method to another method? I'm having an error with the parameters. Do I use the return value from main? And since the return value …

  2. pass array to method Java - Stack Overflow

    Feb 6, 2012 · You do this: private void PassArray() { String[] arrayw = new String[4]; //populate array PrintA(arrayw); } private void PrintA(String[] a) { //do whatever with array here } Just pass …

  3. java - How can I make a method take an array of any type as a parameter ...

    Apr 5, 2017 · I would like to be able to take in any array type as a parameter in a method.: public void foo(Array[] array) { System.out.println(array.length) } Is there a way where I could pass a …

  4. Passing an Array to a Function in Java - GeeksforGeeks

    Nov 13, 2024 · Passing an array to a function is an easy-to-understand task in Java. In this article, we will check how to pass an array as a method parameter. Let function GFG () be called from …

  5. Passing Arrays to Methods in Java - Scientech Easy

    Feb 14, 2025 · The general syntax to calling a method with passing an anonymous array as an argument is as follows: method-name(new data-type[ ]{value0, value1, ..., valuek});

  6. How to Pass an Array to a Method in Java - Delft Stack

    Feb 2, 2024 · Use the data type of the array and square brackets to denote that the parameter is an array. Whenever the method is called, we need to pass the array’s name to the method. …

  7. Arrays Class in Java - GeeksforGeeks

    Apr 7, 2025 · Methods in Java Array Class. The Arrays class of the java.util package contains several static methods that can be used to fill, sort, search, etc in arrays. Now let us discuss …

  8. How To Pass / Return An Array In Java - Software Testing Help

    Apr 1, 2025 · This tutorial will explain how to pass an array as an argument to a method and as a return value for the method in Java with simple examples.

  9. Java Pass Arrays to Methods - JavaBitsNotebook.com

    You can pass an entire array, or a single element from an array, to a method. A method declaration can include array parameters, such as passing the entire array:

  10. Passing Arrays to Methods in Java - Computer Notes

    Just as you can pass primitive type values to methods, you can also pass arrays to a method. To pass an array to a method, specify the name of the array without any square brackets within …

  11. Some results have been removed