Open In App

Scala Int toInt() method with example

Last Updated : 23 Feb, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

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

Method Definition: (Number).toIntReturn 
Type: It returns the converted int datatype value. 

Example 1: 

Scala




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


Output: 

1

 

Example 2: 

Scala




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


Output: 

12

 



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads