Scala Int toInt() method with example
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 objectobject 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 objectobject GfG{ // Main method def main(args:Array[String]) { // Applying toInt method val result = (12).toInt // Displays output println(result) }} |
Output:
12



Please Login to comment...