Scala Int equals(arg0: Any) 方法与示例
如果两个指定的 int 值相等,则使用equals(arg0: Any)方法返回 true,否则返回 false。
Method Definition: def equals(arg0: Any): Boolean
Return Type: It returns true if the two specified int value is equal else false.
示例 #1:
// Scala program of Int equals
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying equals method
val result = (66).equals(22)
// Displays output
println(result)
}
}
输出:
false
示例 #2:
// Scala program of Int equals
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying equals method
val result = (22).equals(22)
// Displays output
println(result)
}
}
输出:
true