Scala Double ==(x: Byte) 方法
在Scala中,Double是64位浮点数,相当于Java的double原始类型。==(x: Byte)方法用于返回true,如果该值等于x,否则为false。
方法定义 – def ==(x: Byte): Boolean
返回 – 如果该值等于x,则返回true,否则返回false。
示例 #1:
// Scala program to explain the working
// of Double ==(x: Byte) method
// 创建对象
object GfG
{
// 主方法
def main(args:Array[String])
{
// 应用 ==(x: Byte) 函数
val result = (12.00123.toDouble).==(12:Byte)
// 显示输出
println(result)
}
}
false
示例 #2:
// Scala program to explain the working
// of Double ==(x: Byte) method
// 创建对象
object GfG
{
// 主方法
def main(args:Array[String])
{
// 应用 ==(x: Byte) 函数
val result = (75.00123.toDouble).==(9:Byte)
// 显示输出
println(result)
}
}
false
更多Scala相关文章,请阅读:Scala 教程
极客教程