java - Basic array initialization and sorting question -


This is a basic Java query

I have a string in which I sort using the string I want Java.util.Arrays.sort

when I write

  string [] myArray = {"A", "B", "C"}; Java.util.Arrays.sort (myArray);  

It is sorted correctly

But when I have

  string [] myArray = new string [10] ; My array [0] = "A"; Mary [1] = "B"; Mary [2] = "C"; Java.util.Arrays.sort (myArray);  

Sort throws a nullreference option

I'm pretty certain that some of its really dumb I'm not right yet. I have to be new string, because hardcoding default value does not get anywhere, anywhere.

When you start the second array, you only start the first three elements. Other elements are started to clear and thus they can not be solved.


Comments