Scala Double +(x: String) 方法与示例
+(x: String)方法用于查找参数中指定的 double 和给定的字符串类型 'x' 的总和。
Syntax: def +(x: String): Double
Returns: It return the sum of the specified double and the given string type ’x’.
示例 1:
// Scala program of +(x: String)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying +(x: String) method
val result = 1.3943245623.+("Geeks")
// Displays output
println(result)
}
}
输出:
1.3943245623Geeks
示例 2:
// Scala program of +(x: String)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying +(x: String) method
val result = 2.394324562334.+("gfg")
// Displays output
println(result)
}
}
输出:
2.394324562334gfg