Open In App

Scala Char charValue() method with example

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

The charValue() method is utilized to return the Char value of the stated Character.

Method Definition: def charValue(): Char

Return Type: It returns Char.

Example: 1#




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


Output:

a

Example: 2#




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


Output:

B


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

Similar Reads