About 246,000 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 …

  2. java - Any way to declare an array in-line? - Stack Overflow

    Feb 28, 2016 · array("blah", "hey", "yo") with the type automatically inferred. I have been working on a useful API for augmenting the Java language to allow for inline arrays and collection types.

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

    Dec 21, 2009 · When assigning a new array to a declared variable, new must be used. Even if you correct the syntax, accessing data[10] is still incorrect (You can only access data[0] to …

  4. Creating an array of objects in Java - Stack Overflow

    I am new to Java and for the time created an array of objects in Java. I have a class A for example -

  5. I want to declare an empty array in Java and then I want do …

    When declaring an array, it's best practice to place the brackets directly after the type, i.e. int[] array.

  6. java - How to declare an ArrayList with values? - Stack Overflow

    ArrayList or List declaration in Java has questioned and answered how to declare an empty ArrayList but how do I declare an ArrayList with values? I've tried the following but it returns a …

  7. Initialising a multidimensional array in Java - Stack Overflow

    Jul 1, 2009 · What is the correct way to declare a multidimensional array and assign values to it? This is what I have:

  8. How to make an array of arrays in Java - Stack Overflow

    While there are two excellent answers telling you how to do it, I feel that another answer is missing: In most cases you shouldn't do it at all. Arrays are cumbersome, in most cases you …

  9. Double array initialization in Java - Stack Overflow

    I was reading a book on Java and came across an example in which an array of type double was initialized in a way that I haven't seen before. What type of initialization is it and where else …

  10. initializing a boolean array in java - Stack Overflow

    In Java arrays are created on heap and every element of the array is given a default value depending on its type. For boolean data type the default value is false.