简体   繁体   中英

<Int> == <String>

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

Because it's defined in 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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM