Scala Double !=(x: Long) 方法与示例
在 Scala 中,Double 是一个 64 位浮点数,相当于 Java 的 double 基本类型。 !=(x: Long)方法用于检查给定的 Double 和 long 值是否彼此相等。
Method Definition – def !=(x: Long): Boolean
Returns – Returns true if this value is not equal to x, false otherwise.
示例 #1:
// Scala program to explain working
// of Double !=(x: Long) function
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying !=(x: Long) function
val result = (10.223100).toDouble.!= (10)
// Displays output
println(result)
}
}
输出:
true
示例 #2:
// Scala program to explain working
// of Double !=(x: Long) function
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying !=(x: Long) function
val result = 11.86000000.toDouble.!= (129600000)
// Displays output
println(result)
}
}
输出:
true