Skip to content
Related Articles

Related Articles

Improve Article
Scala Char toChar() method with example
  • Last Updated : 29 Oct, 2019

The toChar() method is utilized to return itself.

Method Definition: def toChar: Char

Return Type: It returns Char.

Example: 1#




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

Example: 2#




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



My Personal Notes arrow_drop_up
Recommended Articles
Page :