Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Scala Long toDouble() method with example

  • Last Updated : 03 Nov, 2019

The toDouble() method is utilized to convert the specified number into double datatype value.

Method Definition: (Number).toDouble

Return Type: It returns the converted double datatype value.

Example 1:




// Scala program of long toDouble()
// method
  
// Creating object
object Test
{
  
    // Main method
    def main(args : Array[String])
    {
  
        // Implementing toDouble method
        val res = (3).toDouble
  
        // Displays output
        println(res)
    }
}

Output:

3.00

Example 2:




// Scala program of Long toDouble()
// method
  
// Creating object
object Test
{
  
    // Main method
    def main(args : Array[String])
    {
  
        // Implementing toDouble method
        val res = (9.8796).toDouble
  
        // Displays output
        println(res)
    }
}

Output:

9.8796

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!