Scala Double +(x: Float) Method With Example

• Last Updated : 03 Nov, 2019

The +(x: Float) method is used to find the sum of the specified double and the given ‘x’ type of float in the argument.

Syntax: def +(x: Float): Double
Returns: It return the sum of the specified double and the given float type ’x’.

Example 1:

 `// Scala program of +(x: Float) ``// method ``   ` `// Creating object ``object` `GfG ``{  ``   ` `    ``// Main method ``    ``def` `main(args``:``Array[String]) ``    ``{ ``       ` `        ``// Applying +(x: Float) method  ``        ``val` `result ``=` `2.39432456``.+(``4.940213``) ``           ` `        ``// Displays output ``        ``println(result) ``       ` `    ``} ``}  `

Output:

```7.334537559999999
```

Example 2:

 `// Scala program of +(x: Float) ``// method ``   ` `// Creating object ``object` `GfG ``{  ``   ` `    ``// Main method ``    ``def` `main(args``:``Array[String]) ``    ``{ ``       ` `        ``// Applying +(x: Float) method  ``        ``val` `result ``=` `5.39432456``.+(``32.940213``) ``           ` `        ``// Displays output ``        ``println(result) ``       ` `    ``} ``}`

Output:

```38.33453756
```

My Personal Notes arrow_drop_up