The correct way to do it is:
public WordSort(String sentence)
{
wordArray = sentence.split(" ");
}
Your code was the following, which creates a completely different variable called wordArray than the variable you declared at the top of your class. If you don't get that then go read about variable scope.
public WordSort(String sentence)
{
String[] wordArray = sentence.split(" ");
}
Saying String[] wordArray = new String[sentence.length()]; doesn't make sense because sentence.length() is the number of characters in the String, not the number of words. So potentially the user could enter "ghjskdfghgjfhddhfgjh" and your code would create a String[] with a ton of space that wasn't ever used.