Variant 1
/* creating */ String[] array = new String[3]; /* initialization */ array[0] = "One"; array[1] = "Two"; array[2] = "Three";
Variant 2
NOTE: Arrays are indexed from zero [0]. When you use non-existed index is raised java.lang.ArrayIndexOutOfBoundsException exception.
String[] array = { "one", "two", "three" };
No comments:
Post a Comment