In addition to the answers of Luiggi Mendoza and Ivaylo Strandjev I like to point out that if you only want to make sure the strings differ, you can use equals like this:
if (i2 >= nameB.length || (i1 < nameA.length && !nameA[i1].equals(nameB[i2])))