Scala Int toLong() 方法与示例
toLong()方法用于将指定的 int 数转换为 float long 类型的值。
Method Definition: (Number).toLong
Return Type: It returns the converted long datatype value.
示例 #1:
// Scala program of Int toLong()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying toLong method
val result = (1).toLong
// Displays output
println(result)
}
}
输出:
1
示例 #2:
// Scala program of Int toLong()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying toLong method
val result = (12).toLong
// Displays output
println(result)
}
}
输出:
12