Open In App
Related Articles

Scala Int toString() method with example

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report
The toString() method is utilized to return the string representation of the specified value.
Method Definition: def toString(): String Return Type: It returns the string representation of the specified value.
Example #1:
// Scala program of Int toString()
// method 
  
// Creating object 
object GfG 
  
    // Main method 
    def main(args:Array[String]) 
    
      
        // Applying toString method 
        val result = (65).toString
          
        // Displays output 
        println(result) 
    

                    
Output:
65
Example #2:
// Scala program of Int toString()
// method 
  
// Creating object 
object GfG 
  
    // Main method 
    def main(args:Array[String]) 
    
      
        // Applying toString method 
        val result = (1515).toString
          
        // Displays output 
        println(result) 
    

                    
Output:
1515


Last Updated : 04 Feb, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads