The +(x: Char) method is used to find the sum of the specified double and the given ‘x’ type of char in the argument.
Syntax: def +(x: Char): Double
Returns: It return the sum of the specified double and the given char type ’x’.
Example 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)
}
} |
Output:
70.39432456
Example 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)
}
} |
Output:
100.3943245623
Article Tags :