About 648,000 results
Open links in new tab
  1. How to Return an Array in Java? - GeeksforGeeks

    Jun 29, 2022 · Java provides several ways to reverse an array using built-in methods and manual approaches. The simplest way to reverse an array in Java is by using a loop to swap elements …

  2. How to store an array returned by a method in Java

    Feb 24, 2017 · public int[] method() { int z[] = {1,2,3,5}; return z; } The above method does not return an array par se, instead it returns a reference to the array. In the calling function you …

  3. Returning Arrays in Java - Stack Overflow

    Oct 13, 2012 · When a function returns anything, it is essentially replacing the line in which it is called (in your case: numbers();) with the return value. So, what your main method is really …

  4. How to Return an Array in Java? (from a Method) - FavTutor

    Sep 26, 2024 · Learn how to return an array in java in this article with code. We also mentioned how to pass and return an array in java from a method.

  5. java - creating and returning an array from a method - Stack Overflow

    Apr 4, 2010 · Declare the return type to be two dimensional array (int[][]), create the array in your method and return that. int[][] myArray = new int[3][3]; // Populate array. return myArray; See …

  6. How to return an array in Java? - Tpoint Tech

    In Java, there are several ways to return an array from a method, each offering its own advantages and use cases. These methods can be broadly categorized into static arrays, …

  7. Return an Array from a Method in Java - Online Tutorials Library

    Learn how to return an array from a method in Java with this comprehensive guide. Understand the syntax and examples for effective implementation.

  8. How to Return Array in Java - Scientech Easy

    Feb 14, 2025 · Learn how to return an array in java with example, syntax for returning one dimensional array from a method, 2D array from a method in java

  9. How to return an Array in Java [Practical Examples] - GoLinuxCloud

    Feb 22, 2022 · There are three different ways to return an array from a function in Java as listed below: Return an array of primitive type, Return an array of objects, Return a multidimensional …

  10. How to Return an Array in Java: An In-Depth Guide and Best …

    Dec 27, 2023 · Returning an existing array in Java simply involves passing back the reference to it. For example, say we had a method that performed some operation on an array: // Encrypt …

  11. Some results have been removed
Refresh