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 do I determine whether an array contains a particular value in Java ...

    Jul 15, 2009 · How do I determine whether an array contains a particular value in Java? Asked 16 years, 8 months ago Modified 7 months ago Viewed 2.9m times

  3. java - How to add new elements to an array? - Stack Overflow

    May 16, 2010 · The size of an array can't be modified. If you want a bigger array you have to instantiate a new one. A better solution would be to use an ArrayList which can grow as you need it. The …

  4. Get only part of an Array in Java? - Stack Overflow

    The length of an array in Java is immutable. So, you need to copy the desired part into a new array. Use copyOfRange method from java.util.Arrays class:

  5. 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 are better off using …

  6. java - How to create an empty array? - Stack Overflow

    An empty array is an array with no elements. For non-empty arrays, elements are initialized to their default value.

  7. arrays - length and length () in Java - Stack Overflow

    Dec 27, 2009 · In Java, an Array stores its length separately from the structure that actually holds the data. When you create an Array, you specify its length, and that becomes a defining attribute of the …

  8. Convert list to array in Java - Stack Overflow

    There are two styles to convert a collection to an array: either using a pre-sized array (like c.toArray (new String [c.size ()])) or using an empty array (like c.toArray (new String [0]). In older Java versions …

  9. 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 - A[] arr = new A[4]; But this is only creating pointers (references) to A and not 4 objects....

  10. Removing an element from an Array (Java) - Stack Overflow

    42 You can't remove an element from the basic Java array. Take a look at various Collections and ArrayList instead.