Open In App

Scala Long toChar() method with example

Last Updated : 03 Nov, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

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


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads