Initiating an array simply creates "holding spaces" for the elements. Each of those elements is, however, currently "null". If you expect to have a "Player" predefined at every element, then you need to loop over the array and create one in each spot. i.e.
String[] array = new String[5];
for (int i = 0; i < array.length; i++) {
array[i] = "";
}
Edit: The default values for the array elements are as follows:
boolean[] --> false
int[], short[], float[], double[], long[], char[], byte[] --> 0
Object[] --> null
Last edited by masijade; Sep 5th, 2009 at 4:15 am.
Reputation Points: 1471
Solved Threads: 490
Industrious Poster
Offline 4,043 posts
since Feb 2006