带有示例的 Scala Float toLong() 方法
toLong()方法用于将指定的数字转换为 Long 数据类型值。字节数据类型的范围是从-9、223、372、036、854、775、808到+9、223、372、036、854、775、807
Method Definition: (Number).toLong
Return Type: It returns the converted Long datatype value.
示例 #1:
// Scala program of Float toLong()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying toLong method
val result = (5676).toLong
// Displays output
println(result)
}
}
输出:
5676
示例 #2:
// Scala program of Float toLong()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying toLong method
val result = (922365).toLong
// Displays output
println(result)
}
}
输出:
922365