带有示例的 Scala Short +(x: Float) 方法
+(x: Float)方法用于查找所述 Short 值和 Float 类型的“x”之和。
Method Definition: def +(x: Float): Float
Return Type: It returns Float.
示例:1#
// Scala program of +(x: Float)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying +(x: Float) method
val result = (999).+(10.4)
// Displays output
println(result)
}
}
输出:
1009.4
示例:2#
// Scala program of +(x: Float)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying +(x: Float) method
val result = (-996).+(54.1)
// Displays output
println(result)
}
}
输出:
-941.9