Scala Byte ==(x: Short): Boolean
在Scala中,Byte是一个8位有符号整数(相当于Java的字节原始类型)。方法==(x:Short)方法用于返回true,如果该值等于x,则返回false。
方法定义: Byte ==(x: Short): Boolean
返回类型: 如果该值等于x,则返回true,否则返回false。
例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).==(64:Short)
// Displays output
println(result)
}
}
输出:
true
例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 = (25.toByte).==(111:Short)
// Displays output
println(result)
}
}
输出:
false
更多Scala相关文章,请阅读:Scala 教程
极客教程