Your code is not kosher and in fact contains a gross error.
You first create an ArrayList of Integer called cities, and then add a String object to this list via this call:
Why are you doing this?
You know of course that "x" is a string and has absolutely no relationship to the variable x that holds an int, correct?