【发布时间】:2010-11-19 03:26:15
【问题描述】:
我正在处理一个声明为整数的变量,并发现 > 不是整数的成员。这是一个简单的例子:
scala> i
warning: there were deprecation warnings; re-run with -deprecation for details
res28: Integer = 3
scala> i > 3
<console>:6: error: value > is not a member of Integer
i > 3
^
将其与 Int 进行比较:
scala> j
res30: Int = 3
scala> j > 3
res31: Boolean = false
Integer 和 Int 有什么区别?我看到了弃用警告,但我不清楚它为什么被弃用,鉴于已经弃用,为什么它没有 > 方法。
【问题讨论】:
-
感谢大家提供有用的答案。你们都回答了我的问题,所以我会让评分最高的回答上升到顶部并将其标记为答案。同时,我已对您的所有回复进行了评分。