Skip to content
Related Articles

Related Articles

Scala Int toInt() method with example
  • Last Updated : 23 Feb, 2021

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

 

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.




My Personal Notes arrow_drop_up
Recommended Articles
Page :