Scala Float +(x: Double) 方法及其示例
+(x: Double) 方法用于返回指定 float 值和 double 值的和。
方法定义:(Float_Value).+(Double_Value)
返回类型:它返回指定 float 值和 double 值的和。
示例 #1:
// Scala program of Float +(x: Double)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying +(x: Double) function
val result = (6.0).+(5)
// Displays output
println(result)
}
}
11.0
示例 #2:
// Scala program of Float +(x: Double)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying +(x: Double) function
val result = (100.0).+(8)
// Displays output
println(result)
}
}
108.0
更多Scala相关文章,请阅读:Scala 教程