About 164,000 results
Open links in new tab
  1. Different Ways To Declare And Initialize 2-D Array in Java

    Nov 13, 2024 · When you initialize a 2D array, you must always specify the first dimension(no. of rows), but providing the second dimension(no. of columns) may be omitted. Java compiler is …

  2. Initialising a multidimensional array in Java - Stack Overflow

    Dec 4, 2013 · String[][] myStringArray = new String [x][y]; is the correct way to initialise a rectangular multidimensional array. If you want it to be jagged (each sub-array potentially has …

  3. Syntax for creating a two-dimensional array in Java

    Jan 17, 2021 · You can initialize this array at compile time like below: int[][] multD = {{2, 4, 1}, {6, 8}, {7, 3, 6, 5, 1}}; You can easily iterate all elements in your array:

  4. Java Multi-Dimensional Arrays - GeeksforGeeks

    Apr 23, 2025 · Two-Dimensional Array (2D-Array) Two-dimensional array is the simplest form of a multidimensional array. A 2-D array can be seen as an array storing multiple 1-D array for …

  5. Declare and initialize two-dimensional arrays in Java

    Oct 12, 2023 · To initialize a two-dimensional array of characters, we can use the String.toCharArray() method in Java. This method converts the given string into a sequence of …

  6. Initializing Arrays in Java - Baeldung

    Dec 16, 2024 · In this article, we explored different ways of initializing arrays in Java. Also, we learned how to declare and allocate memory to arrays of any type, including one-dimensional …

  7. How to Initialize an Array in Java? - GeeksforGeeks

    Apr 14, 2025 · In this article, we will discuss different ways to declare and initialize an array in Java. Understanding how to declare an array in Java is very important. In Java, an array is …

  8. Initialize 2D array in Java - Java2Blog

    Jan 11, 2021 · There are several ways to create and initialize a 2D array in Java. Let’s see some examples. Initialize 2D array Using for loop. This is the simplest approach in which we create …

  9. java - Initialize 2D array - Stack Overflow

    Dec 12, 2012 · If it is to simply initialize a 2D array to values 0-9, it would be much easier to just define, declare and initialize within the same statement like this: private char[][] table = {{'1', '2', …

  10. Mastering Java Multidimensional Arrays: A Comprehensive Guide

    Apr 7, 2025 · Explore the intricacies of Java's multidimensional arrays with our in-depth guide. Learn how to declare, initialize, and utilize arrays of arrays to manage complex data structures …

  11. Some results have been removed
Refresh