📜  Scala Int toLong() 方法与示例

📅  最后修改于: 2022-05-13 01:54:38.236000             🧑  作者: Mango

Scala Int toLong() 方法与示例

toLong()方法用于将指定的 int 数转换为 float long 类型的值。

示例 #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