Because int is a primitive type, not a class, thus it is not directly comparable to String. The corresponding class type is Integer, spelled according to the class naming conventions.
Similar pairs of primitive and class types are
bytevsByteshortvsShortlongvsLongfloatvsFloatdoublevsDoublebooleanvsBooleancharvsCharacter