Open In App

Scala Char getType() method with example

Last Updated : 03 Nov, 2019
Comments
Improve
Suggest changes
Like Article
Like
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
// 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
// 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.

Article Tags :

Similar Reads