📜  Scala Long /(x: Long) 方法

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

Scala Long /(x: Long) 方法

在 Scala 中,Long 是一个 64 位有符号整数,相当于 Java 的 long 原始类型。 /(x: Long)方法用于返回该值与给定值 x 的商。

示例 #1:

// Scala program to explain the working 
// of Long /(x: Long) method
   
// Creating object
object GfG
{ 
   
    // Main method
    def main(args:Array[String])
    {
       
        // Applying /(x: Long) function
        val result = (12.0021.toLong)./(8:Long)
           
        // Displays output
        println(result)
       
    }
} 
输出:
1

示例 #2:

// Scala program to explain the working 
// of Long /(x: Long) method
   
// Creating object
object GfG
{ 
   
    // Main method
    def main(args:Array[String])
    {
       
        // Applying /(x: Long) function
        val result = (16.0123.toLong)./(13:Long)
           
        // Displays output
        println(result)
       
    }
}
输出:
1