Skip to content
Related Articles

Related Articles

Improve Article

Scala Char toString() method with example

  • Last Updated : 29 Oct, 2019
Geek Week

The toString() method is utilized to convert a stated character into String.

Method Definition: def toString: String

Return Type: It returns the String representation of the stated character.

Example: 1#




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

Example: 2#




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



My Personal Notes arrow_drop_up
Recommended Articles
Page :