第一题:在Scala REPL 中键入3.,然后按Tab键。有哪些方法可以呗应用?
scala> 3.
!= + <= >> getClass toDouble toString
## - <init> >>> hashCode toFloat unary_+
% / == ^ isInstanceOf toInt unary_-
& < > asInstanceOf toByte toLong unary_~
* << >= equals toChar toShort |
第二题:在Scala REPL 中,计算3的平方根,然后再对该值求平方。现在,这个结果与3相差多少?(提示:res变量是你的朋友)
scala> math.sqrt(3)
res0: Double = 1.7320508075688772
scala> math.pow(res0,2)
res1: Double = 2.9999999999999996
第三题:res变量是val还是var?