I\'m trying to remove the empty element from the array by copying the existing element to a new array. However, initialization of the new array is causing my return value to
You shouldn't compare strings using == operator. This is incorrect, because strings are objects. Use .equals() method instead, this should fix your problem.
Rest part of your code is quite confusing, it's hard to understand what you are trying to achieve: you create new string array store each time in loop iterations, and then assign its null (by default) values to words[i]. You should elaborate your code and algorithm.