Scala 字节 -(x: Char): Int
在 Scala 中,Byte 是一个 8 位有符号整数(相当于 Java 的 byte 原始类型)。方法 -(x:Char) 方法用于返回该值与 x 的差
Method Definition: Byte -(x: Char): Int
Return Type: It returns the difference of this value by x.
示例 #1:
// Scala program of Byte -(x: Char)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Byte -(x: Char) function
val result = (156.toByte).-('C':Char)
// Displays output
println(result)
}
}
输出:
-167
示例 #2:
// Scala program of Byte -(x: Char)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Byte -(x: Char) function
val result = (121.toByte).-('G':Char)
// Displays output
println(result)
}
}
输出:
50