Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Kotlin 未解析的引用:[BigInteger]。longValue_Kotlin_Biginteger - Fatal编程技术网

Kotlin 未解析的引用:[BigInteger]。longValue

Kotlin 未解析的引用:[BigInteger]。longValue,kotlin,biginteger,Kotlin,Biginteger,科特林密码 import java.math.BigInteger fun main(args: Array<String>) { println(BigInteger("1").longValue()) } import java.math.biginger 趣味主线(args:Array){ println(biginger(“1”).longValue()) } 生成编译错误未解析引用:longValue(dito表示intValue)。BigInteger的其他方

科特林密码

import java.math.BigInteger
fun main(args: Array<String>) {
    println(BigInteger("1").longValue())
}
import java.math.biginger
趣味主线(args:Array){
println(biginger(“1”).longValue())
}

生成编译错误
未解析引用:longValue
(dito表示
intValue
)。BigInteger的其他方法,如
modInverse
,没有任何问题。除非有我没有看到的打字错误,否则我在这里很难理解为什么会发生这种情况…

如评论中所述,您可以使用
.toLong()
.toInt()
。此外,还有
longValueExact()
intValueExact()


.toLong()
实际上解析为
longValue()
(在IntelliJ中按住CTRL键并单击),因此看起来这是为了符合语言标准

使用toLong()。谢谢,成功了。尽管Kotlin禁止Java类的公共方法,但这怎么可能呢?我不知道他们是如何做到的,但我知道他们是如何统一/净化API的。例如,String.split()接受正则表达式而不是字符串。