Open In App

Scala Int toLong() method with example

Last Updated : 04 Feb, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

The toLong() method is utilized to convert the specified int number into float long type value.

Method Definition: (Number).toLong

Return Type: It returns the converted long datatype value.

Example #1:




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


Output:

1

Example #2:




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


Output:

12


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads