if (next == string2)

Don't use == to compare objects, use the equals method instead.