About 84,800 results
Open links in new tab
  1. How can I create a generic array in Java? - Stack Overflow

    In Java 8, we can do a kind of generic array creation using a lambda or method reference. This is similar to the reflective approach (which passes a Class), but here we aren't using reflection.

  2. java - create an array of long - Stack Overflow

    Jan 29, 2013 · 2 i need an array of 10^9 elements You can create an array of one billion using an int value. Make n an int, and you can create an array with new long[n] Note: this will use 8 GB …

  3. java - How to put a Scanner input into an array... for example a …

    May 8, 2010 · How to put a Scanner input into an array... for example a couple of numbers Asked 15 years, 5 months ago Modified 3 years, 6 months ago Viewed 483k times

  4. Java: how to initialize String []? - Stack Overflow

    Java: how to initialize String []? Asked 15 years, 7 months ago Modified 6 years, 5 months ago Viewed 1.0m times

  5. 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.

  6. Java array of constants - Stack Overflow

    Oct 13, 2015 · How is it possible to declare and initialize an array of constants in Java, without using enums ? static final Type[] arrayOfConstants = new Type[10]; // not an array of constants

  7. Java: how do I initialize an array size if it's unknown?

    Apr 3, 2013 · You should use a List for something like this, not an array. As a general rule of thumb, when you don't know how many elements you will add to an array before hand, use a …

  8. 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 …

  9. How to create correct JSONArray in Java using JSONObject

    In java 6 org.json.JSONArray contains the put method and in java 7 javax.json contains the add method. An example of this using the builder pattern in java 7 looks something like this:

  10. 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.