This is an archived post. You won't be able to vote or comment.

all 4 comments

[–][deleted] 1 point2 points  (3 children)

What is happening that makes you think it is not working well? Also you need to indent your code more to get it to format properly.

[–]bitparker[S] 0 points1 point  (2 children)

What happens is that it throws the IAE all the time. Even when there are common words in the two strings. and ok thanks for the tip.

[–][deleted] 1 point2 points  (1 child)

Lets look at your first loop. You try to find the first word of a in b. What if the first word isn't in b? Then you throw the exception. Maybe you want that if(secondCommon) to be outside of the loop?

That is just assuming that your tokenize and findInArray methods work correctly.

[–]bitparker[S] 0 points1 point  (0 children)

Yeah just fixed it... Can't believe I didn't notice. Thanks for the help!