Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Scala Long toChar() method with example

  • Last Updated : 03 Nov, 2019

The toChar() method is utilized to convert the specified number into character value. Here the specified number is ASCII value.

Method Definition: (Number).toChar

Return Type: It returns the converted character value.

Example 1:




// Scala program of Long toChar()
// method
  
// Creating object
object Test
{
  
    // Main method
    def main(args : Array[String])
    {
  
        // Implementing toChar method
        val res = (68).toChar
  
        // Displays output
        println(res)
    }
}

Output:

D

Example 2:




// Scala program of Long toChar()
// method
  
// Creating object
object Test
{
  
    // Main method
    def main(args : Array[String])
    {
  
        // Implementing toChar method
        val res = (82).toChar
  
        // Displays output
        println(res)
    }
}

Output:

R

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!