Scala Int ==(x: Short)方法及示例
利用 ==(x: Short) 方法,如果指定的int值等于short值,返回true,否则返回false。
方法定义:(Int_Value).==(Short_Value)
返回类型。如果指定的int值等于short值,则返回true,否则返回false。
例子 #1 :
// Scala program of Int ==(x: Short)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Int ==(x: Short) function
val result = (10).==(10)
// Displays output
println(result)
}
}
输出。
true
例子#2
// Scala program of Int ==(x: Short)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Int ==(x: Short) function
val result = (500).==(100)
// Displays output
println(result)
}
}
输出。
false
极客教程