About 289,000 results
Open links in new tab
  1. How to use java.util.Arrays - Stack Overflow

    Apr 6, 2011 · I think what you are trying to ask is how to use Arrays in java. In which case you don't import java.util.Arrays, you use the array syntax.

  2. How do I declare and initialize an array in Java?

    Jul 29, 2009 · The third way of initializing is useful when you declare an array first and then initialize it, pass an array as a function argument, or return an array. The explicit type is required.

  3. Can I pass an array as arguments to a method with variable arguments …

    I actually tried the code above, with the intention to pass the array args as arguments to the method. However, I didn't realize that I should've prepended extraVar to args first. When you know that …

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

  5. 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, 5 months ago Modified 4 months ago Viewed 2.9m times

  6. Finding the max/min value in an array of primitives using Java

    Sep 28, 2009 · If you have an array of one of those, you can find the min or max using Arrays.stream(). A comprehensive solution to the problem of reductions over primitive arrays is rather than implement …

  7. How to find the index of an element in an array in Java?

    Oct 2, 2016 · I am looking to find the index of a given element, knowing its contents, in Java. I tried the following example, which does not work: class masi { public static void main( String[] args ) { ...

  8. Java - Creating an array of methods - Stack Overflow

    5 Since Java does not have the concept of methods as first-class entities, this is only possible using reflection, which is painful and error-prone. The best approximation would probably be to have the …

  9. Do Java's regular arrays have built in methods? - Stack Overflow

    Apr 11, 2015 · An array is a reference type, which means it's a sub-class of Object. Therefore all the methods of Object can be invoked on arrays. Perhaps the book meant that arrays don't introduce any …

  10. How to add a method to "the array class" in Java?

    Jan 10, 2023 · The Java Arrays API does have methods that can resize arrays. If an array is made larger, zeroes are added. See public static int[] copyOf (int[] original, int newLength), for example.