scala Byte -(x: Long): Long
在Scala中,Byte是一个8位有符号整数(等同于Java的byte原始类型)。 -(x:Long)方法用于返回此值与x的差异
方法定义: Byte -(x: Long): Long
返回类型: 它返回此值与x的差异。
示例1:
// Scala program of Byte -(x: Long)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Byte -(x: Long) function
val result = (167.toByte).-(125:Long)
// Displays output
println(result)
}
}
输出:
-213
示例2:
// Scala program of Byte -(x: Long)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Byte -(x: Long) function
val result = (128.toByte).-(2:Long)
// Displays output
println(result)
}
}
输出:
-130
更多Scala相关文章,请阅读:Scala 教程