Which part do you need help with??
If you use a String array, you will probably end up with duplicate words in the arrays. That would give you the same results on the compare each time. Perhaps using a Set or a Sorted set would be better, and just discard words that you have already loaded.
You need to have 2 FileInputStreams (then
you should run those through 2 DataInputStreams) then read the first file, one character at a time (using readChar()) appending the character onto a variable String - probably until you run into a space (that would be the end of the
word). Then take the variable and load it into the first array at index 0, and clear the variable. Keep going until all of the words of the first file are loaded.
You could probably start reading the second file in the same manner until you find the first word, and stop and search the first array for that word right then. If you find a match, load the match into the second array.
Is this sort of what you need to do???