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

    Jul 29, 2009 · You can either use array declaration or array literal (but only when you declare and affect the variable right away, array literals cannot be used for re-assigning an array). For …

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

    Apr 1, 2010 · In Java 8 we can also make use of streams e.g. String[] strings = Stream.of("First", "Second", "Third").toArray(String[]::new); In case we already have a list of strings (stringList) …

  3. Java - How do I make a String array with values?

    Dec 18, 2011 · Create array from a string Hot Network Questions Is it a faux pas for a reviewer of a published math paper to immediately solve/publish problems it leaves open?

  4. java - Create a two dimensional string array anArray [2] [2] - Stack ...

    Dec 3, 2013 · The question: 3. Create a Java program called TwoDimArray and implement the following: Create a two dimensional string array anArray[2][2]. Assign values to the 2d array …

  5. How can I declare dynamic String array in Java - Stack Overflow

    Apr 28, 2015 · I am using String Array declare as zoom z[]=new String[422];. But this array stores value from 0 to 32, so I got null pointer exception after looping value 32.

  6. How to declare a static string array in Java? - Stack Overflow

    May 2, 2013 · private static final String[] STRING_ARRAY = {"foo", "bar", "baz"}; In my example I have assumed that you won't want to change the instance of array and so have declared it …

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

    Feb 28, 2016 · You are right, when I wrote this I hadn't used varargs much--and I used array initialization quite a bit before varargs existed in java. The one part I'd still prefer arrays for is …

  8. How can I initialize a String array with length 0 in Java?

    The Java Docs for the method String[] java.io.File.list(FilenameFilter filter) includes this in the returns description: The array will be empty if the directory is empty or if no names were …

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

    Jul 23, 2017 · @Terence: It does the same as the first: It creates an array of string array references, initialized to the values array1, array2, array3, array4 and array5 - each of which is …

  10. String array initialization in Java - Stack Overflow

    First up, this has got nothing to do with String, it is about arrays.. and that too specifically about declarative initialization of arrays. As discussed by everyone in almost every answer here, you …

Refresh