Scala Byte *(x:Short):Int

Scala Byte *(x:Short):Int

在Scala中,Byte是一个8位有符号整数(与Java的byte原始类型相同)。使用*(x: Short)方法返回此值和x的乘积。

方法定义: Byte *(x: Short):Int
返回类型: 它返回此值和x的乘积。

示例#1:

// Scala program of Byte *(x: Short)
// method 
  
// Creating object 
object GfG 
{ 
  
    // Main method 
    def main(args:Array[String]) 
    { 
      
        // Applying Byte *(x: Short) function 
        val result = (64.toByte).*(12:Short) 
          
        // Displays output 
        println(result) 
      
    } 
}  

输出:

768

示例#2:

// Scala program of Byte *(x: Short)
// method 
  
// Creating object 
object GfG 
{ 
  
    // Main method 
    def main(args:Array[String]) 
    { 
      
        // Applying Byte *(x: Short) function 
        val result = (17.toByte).*(128:Short) 
          
        // Displays output 
        println(result) 
      
    } 
}  

输出:

2176

更多Scala相关文章,请阅读:Scala 教程

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程