The getNumericValue() method is utilized to return the numeric value of the given character.
Method Definition: def getNumericValue: Int
Return Type: It returns Integer.
Example: 1#
// Scala program of getNumericValue() // method // Creating object object GfG
{ // Main method
def main(args : Array[String])
{
// Applying getNumericValue() method
val result = ( 'Z' ).getNumericValue
// Displays output
println(result)
}
} |
Output:
35
Example: 2#
// Scala program of getNumericValue() // method // Creating object object GfG
{ // Main method
def main(args : Array[String])
{
// Applying getNumericValue() method
val result = 'B' .getNumericValue
// Displays output
println(result)
}
} |
Output:
11