Scala short ==(x: Short): 布尔值
简而言之,一个 16 位有符号整数(相当于 Java 的 short 原始类型)是 scala.AnyVal 的子类型。如果该值等于 x,则使用 ==(x: Short) 方法返回 true,否则返回 false。
Method Definition: def ==(x: Short): Boolean
Return Type: It returns true if this value is equal to x, otherwise false.
示例 #1:
// Scala program of Short ==(x: Short)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Short ==(x: Short) function
val result = (99.toShort).==(99:Short)
// Displays output
println(result)
}
}
输出:
true
示例 #2:
// Scala program of Short ==(x: Short)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Short ==(x: Short) function
val result = (102.toShort).==(101:Short)
// Displays output
println(result)
}
}
输出:
false