The Wayback Machine - https://web.archive.org/web/20221119055519/https://www.geeksforgeeks.org/scala-int-toint-method-with-example/
Skip to content
Related Articles

Related Articles

Scala Int toInt() method with example

Improve Article
Save Article
  • Last Updated : 23 Feb, 2021
Improve Article
Save Article

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

 


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!