Skip to content

Instantly share code, notes, and snippets.

@chrisyeung1121
Created March 24, 2015 15:43
Show Gist options
  • Save chrisyeung1121/fda7ce5ca5edb2a615b6 to your computer and use it in GitHub Desktop.
Save chrisyeung1121/fda7ce5ca5edb2a615b6 to your computer and use it in GitHub Desktop.
Characters Array v.s. String Array
String[] stringArray = {"a", "b", "c"}; // Compile okay
String[] stringArray2 = {'a', 'b', 'c'}; // single quotation is for Character Class
Character[] charArray = {'a', 'b', 'c', 'd'}; // Compile okay
Character[] charArray2 = {"a", "b"}; // Error: Double quotation is parsed as String
Character[] charArray3 = {'ab'}; // Error: Too many characters. Can only have one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment