Skip to content

Instantly share code, notes, and snippets.

@dhust
Created August 3, 2013 00:46
Show Gist options
  • Select an option

  • Save dhust/6144553 to your computer and use it in GitHub Desktop.

Select an option

Save dhust/6144553 to your computer and use it in GitHub Desktop.
/***** Declaring an array of 10 Strings *****/
String[] myList = new String[10];
// prints the second element of the array, since it's [1]
System.out.println( myList[1] );
/***** Declaring and initializing an array of 10 Strings *****/
String[] myList = { null, null, null, null, null, null, null, null, null, null };
// prints the second element of the array
System.out.println(myList[1]);
// OUTPUT
// null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment