Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Scala Int toDouble() method with example

  • Last Updated : 04 Feb, 2020

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

Method Definition: (Number).toDouble

Return Type: It returns the converted double datatype value.

Example #1:




// Scala program of Int toDouble()
// method
  
// Creating object
object GfG
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying toDouble method
        val result = (1).toDouble
          
          
        // Displays output
        println(result)
      
    }
Output:
1.0

Example #2:




// Scala program of Int toDouble()
// method
  
// Creating object
object GfG
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying toDouble method
        val result = (12).toDouble
          
          
        // Displays output
        println(result)
      
    }
Output:
12.0




My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!