Reading words from a text file into an array

Okay, so I have the method:

publicvoid addWord(String word)

{

}

in this spellchecker file which I'm supposed to code up. This method is called by another file which adds words from the text file into the spellchecker, so the words from the text file are automatically fed into the spellchecker as soon as the program starts up. I want to store these words into an array. I can manage to get the words into an array, however, the problem arises that it stores every single word from the text file into every element of the array. I want each element of the array to store a single word from the text file so later I can write a method which sorts these words into alphabetical order. Any advice? Thanks in advance.

[864 byte] By [Dark_Advocatea] at [2007-11-26 20:59:21]
# 1
Can you put the complete code here
penupatia at 2007-7-10 2:29:37 > top of Java-index,Java Essentials,New To Java...
# 2
i have these codes all ready for you, talk to me on AIM my sn is my127001
mkoryaka at 2007-7-10 2:29:38 > top of Java-index,Java Essentials,New To Java...
# 3

Many thanks for offering your help, but I managed to fix the problem myself after realising that it was all just a silly mistake. Now I'm faced with another problem which comes in the form of nullpointerexceptions.

public class SpellChecker

{

String[] words = new String[45];

String temp;

int i;

public void addWord(String word)

{

addingWord(word);

quickSort(words, 0, words.length);

for(int k = 0; k < words.length; k++)

{

System.out.println(words[k]);

}

}

public void addingWord(String word)

{

words[i] = word;

i++;

}

public void quickSort(String words[], int lo0, int hi0)

{

int low = lo0;

int high = hi0;

String middle;

if (hi0 > lo0)

{

middle = words[(lo0 + hi0) / 2];

while (low <= high)

{

while ((low < hi0) && (words[low].compareTo(middle) < 0))

++low;

while ((high > lo0) && (words[high].compareTo(middle) > 0))

--high;

if (low <= high)

{

String temp = words[high];

words[high] = words[low];

words[low] = temp;

++low;

--high;

}

}

if (lo0 < high)

quickSort(words, lo0, high);

if (low < hi0)

quickSort(words, low, hi0);

}

}

}

I sat down with it for several hours but I still can't seem to rectify the problem. Is anyone able to spot the problem? They occur at the line:

while ((low < hi0) && (words[low].compareTo(middle) < 0))

Thanks!

Dark_Advocatea at 2007-7-10 2:29:38 > top of Java-index,Java Essentials,New To Java...
# 4
I have no idea why a null value is being passed into the compareTo line..
Dark_Advocatea at 2007-7-10 2:29:38 > top of Java-index,Java Essentials,New To Java...