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

    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. How to make an array of arrays in Java - Stack Overflow

    How to make an array of arrays in Java Asked 14 years, 10 months ago Modified 8 years, 4 months ago Viewed 476k times

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

    There are 3 steps to create arrays in Java - Declaration – In this step, we specify the data type and the dimensions of the array that we are going to create. But remember, we don't mention …

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

    Read user input into a variable and use its value to initialize the array. myArray = new int[someVarSetEarlier] if you want to get the size in advance or use a List if you want the …

  5. java - Make copy of an array - Stack Overflow

    Java Array Copy Methods Object.clone (): Object class provides clone () method and since array in java is also an Object, you can use this method to achieve full array copy. This method will …

  6. Java - How do I make a String array with values? - Stack Overflow

    Dec 18, 2011 · I know how to make an empty array, but how do I make a String array with values from the start?

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

    Feb 28, 2016 · 38 You can directly write the array in modern Java, without an initializer. Your example is now valid. It is generally best to name the parameter anyway.

  8. Resize an Array while keeping current elements in Java?

    82 I have searched for a way to resize an array in Java, but I could not find ways of resizing the array while keeping the current elements. I found for example code like int[] newImage = new …

  9. java - Convert an integer to an array of digits - Stack Overflow

    0 First take input from the user as int, convert it into String, and make a character array of size of str.length(). Now populate a character array with a for loop using charAt().

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

    If you want to store n elements then the array index starts from zero and ends at n-1. Another way of creating a two dimensional array is by declaring the array first and then allotting memory for …