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