About 50 results
Open links in new tab
  1. How do I declare and initialize an array in Java? - Stack Overflow

    Jul 29, 2009 · This answer fails to properly address the question: "How do I declare and initialize an array in Java?" Other answers here show that it is simple to initialize float and int arrays when they …

  2. How to initialize an array in Java? - Stack Overflow

    Dec 21, 2009 · Notice the difference between the two declarations. When assigning a new array to a declared variable, new must be used. Even if you correct the syntax, accessing data[10] is still …

  3. java - Difference between int [] array and int array - Stack Overflow

    Oct 24, 2010 · I have recently been thinking about the difference between the two ways of defining an array: int[] array int array[] Is there a difference?

  4. java - Initializing an array after the declaration - Stack Overflow

    Java arrays are full-fledged objects with all that implies. For now the main thing it implies is that we have to allocate them with new. Initializing Arrays Individual elements of the array are referenced by the …

  5. Java Array Declaration Bracket Placement - Stack Overflow

    Jul 9, 2009 · In java your array declaration can be after the type or the name of the variable, so it is ok both methods to perform the same functionality. args are used to store command line arguments.

  6. C++ and Java array declaration/definition - Stack Overflow

    Sep 25, 2015 · A three-dimensional array in Java is merely a one-dimensional array of references to arrays of references to arrays of whatever base type you wanted. Or in C++ speak, an array in Java, …

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

    int array[] = new int[5]; where int is a data type, array [] is an array declaration, and new array is an array with its objects with five indexes. Like that, you can write a two-dimensional array as the following.

  8. Array declaration and initialization in Java - Stack Overflow

    Jun 1, 2021 · As a direct answer to your question, this is the case because the Java language was defined in this way. When we declare a new field or local variable, we may initialize it by either an …

  9. Initialising a multidimensional array in Java - Stack Overflow

    Jul 1, 2009 · 9 Multidimensional Array in Java Returning a multidimensional array Java does not truely support multidimensional arrays. In Java, a two-dimensional array is simply an array of arrays, a …

  10. How does the Java array argument declaration syntax "..." work?

    I believe this was implemented in Java 1.5. The syntax allows you to call a method with a comma separated list of arguments instead of an array.