Try s.equals("/?") in place of s=="/?". The "==" operator tests if the two object references point to the same object, which is not true in this case. String class overrides the "equals" method in the Object class, to compare the values of the two strings in question and return true if they are the same. It DOES NOT check to see if both the strings point to the same object in memory.