关于scala:<Int> == <String>

<Int> == <String>

为什么即使未在API中为字符串定义此运算符,也可以像= x0一样将Scala中的Int和字符串与==进行比较(http://www.scala-lang.org/api /2.11.8/index.html#scala.Int)?


因为它是在Any中定义的:def ==(arg0: Any): Boolean

Test two objects for equality. The expression x == that is equivalent to if (x eq null) that eq null else x.equals(that).