Scala Int ==(x: Int)方法示例
该 ==(x: Int) 方法用于返回 true,如果指定的第一个 int 值等于第二个 int 值,则返回 false。
方法定义:(第一个 Int 值).(第二个 Int 值)
返回类型:如果指定的第一个 int 值等于第二个 int 值,则返回 true,否则返回 false。
示例 #1:
// Scala program of Int ==(x: Int)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Int ==(x: Int) function
val result = (10).==(10)
// Displays output
println(result)
}
}
true
示例 #2:
// Scala program of Int ==(x: Int)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Int ==(x: Int) function
val result = (500).==(100)
// Displays output
println(result)
}
}
false
阅读更多:Scala 教程
极客教程