Scala Byte*(x: Byte): Int
在Scala中,Byte是8位有符号整数(相当于Java的byte原始类型)。 方法*(x:Byte)用于返回此值和x的乘积。
方法定义: Byte*(x: Byte): Int
返回类型: 它返回此值和x的乘积。
例1:
// Scala program of Byte *(x: Byte)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Byte *(x: Byte) function
val result = (64.toByte).*(12:Byte)
// Displays output
println(result)
}
}
输出:
768
例2:
// Scala program of Byte *(x: Byte)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Byte *(x: Byte) function
val result = (125.toByte).*(11:Byte)
// Displays output
println(result)
}
}
输出:
1375
更多Scala相关文章,请阅读:Scala 教程