Because Java only knows it's an Object, it needs to be cast. The UIDevice method `pressKeyCode` expects two Integers. Since the param could be either Integer or String, casting alone won't work as casting an Integer as a String or a String as an Integer will throw a ClassCastException.