Open In App

Scala Char getType() method with example

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

The getType() method is utilized to return a value of type integer representing the character’s general category.

Method Definition: def getType: Int

Return Type: It returns an Integer.

Example: 1#




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


Output:

1

Here, the category of ‘B’ is 1.
Example: 2#




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


Output:

24

Here, the category of ‘%’ is 24.



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads