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.