Open In App

Scala Float toString() method with example

Last Updated : 29 Oct, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

The toString() method is utilized to convert the specified number into string data type value.

Method Definition: (Number).toString

Return Type: It returns the converted String datatype value.

Example #1:




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


Output:

'56'

Example #2:




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


Output:

'56.9'


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

Similar Reads