Freewind @ Thoughtworks scala java javascript dart 工具 编程实践 月结 math python english [comments admin] [feed]

(2011-09-13) "val s:BigInt = 3333333333333333 为什么编译出错"

广告: 云梯:翻墙vpn (省10元) 土行孙:科研用户翻墙http proxy (有优惠)

val s:BigInt = 3333333333333333 为什么编译出错,不是说scala中,会自动把超长的整数变为BigInt吗?

在stackoverflow上有人提了这个问题,也有回答:

http://stackoverflow.com/questions/1689414/java-scala-biginteger-pasting

简单点说,就是如果在编码中手动写一个超长的int,还是要用java中的方式:

val s:BigInt = BigInt(“3333333333333333333333333”)```

comments powered by Disqus