About 175,000 results
Open links in new tab
  1. Syntax for creating a two-dimensional array in Java

    Jan 17, 2021 · In Java, a two-dimensional array can be declared as the same as a one-dimensional array. In a one-dimensional array you can write like. int array[] = new int[5]; where …

  2. Getting the array length of a 2D array in Java - Stack Overflow

    It was really hard to remember that. int numberOfColumns = arr.length; int numberOfRows = arr[0].length; Let's understand why this is so and how we can figure this out when we're given …

  3. How do I declare and initialize an array in Java? - Stack Overflow

    Jul 29, 2009 · maybe important to note that multi-dimensional arrays are actually arrays of arrays, so int[][] array = new int[2][]; is creating an array with 2 positions (that can hold an int[] array …

  4. Making a mixed 2D array in java - Stack Overflow

    It's sort of possible, but it's usually a very bad idea. You could create an array of Object[][] and add String and Integers to it. But don't do this. If you need to connect a String and an int, …

  5. Convert List to 2D Array (Java) - Stack Overflow

    Mar 17, 2017 · The problem lies in this line of code: int[][] result = new int[list.size()][rows]; As you are initializing the result to a 2D array having rows equals to list.size() you are getting always …

  6. java - Explicitly assigning values to a 2D Array? - Stack Overflow

    This may not be the correct data type to use for this, but I just want to assign an int, then another int without a for loop into a 2D array, the values will actual be returns from another function, …

  7. java - Converting 2D ArrayList to 2D Array - Stack Overflow

    Jul 21, 2015 · A double[] is an array of doubles, so the actual values are stored in the array, instead of just pointers. This is why a double[] never contains null. This makes it that we have …

  8. java - convert two-dimensional array to string - Stack Overflow

    Mar 25, 2013 · Convert String into 2D int array. 0. String Array to 2D String array. 0. Convert string to 2d array (java) 1.

  9. The best way to print a Java 2D array? - Stack Overflow

    @Ashika's answer works fantastically if you want (0,0) to be represented in the top, left corner, per standard matrix convention.

  10. Finding minimum and maximum in Java 2D array - Stack Overflow

    Your problem is: You are sorting the array of int arrays instead of sorting each individual int in each int array. To solve this: Loop through each int array in the array of int arrays. Instructions …

Refresh