📜  Scala Long *(x: Byte) 方法

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

Scala Long *(x: Byte) 方法

在 Scala 中,Long 是一个 64 位有符号整数,相当于 Java 的 long 原始类型。 *(x:Byte)方法用于返回指定的 Long 值和 Byte 值的乘积。

示例 #1:

// Scala program to explain working of
// Long *(x: Byte) method
  
// Creating object
object GfG
{ 
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying *(x: Byte) function
        val result = (13.toLong).*(2^4:Byte)
          
        // Displays output
        println(result)
      
    }
} 

输出:

78

示例 #2:

// Scala program to explain working of
// Long *(x: Byte) method
  
// Creating object
object GfG
{ 
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying *(x: Byte) function
        val result = (150.toLong).*(2^5:Byte)
          
        // Displays output
        println(result)
      
    }
} 

输出:

1050