Example For getNumericValue() method in java

Example For getNumericValue() method in java


Posted in : Core Java Posted on : October 1, 2010 at 12:55 PM Comments : [ 0 ]

In this Example, We will Introduced you about the getNumericValue() method of the character class.

Example For getNumericValue() method in java

In this Example, We will Introduced you about the getNumericValue() method of the character class. This method returns the numeric value of the character.  If any character don't have any numeric value than it returns -1 and returns -2 if  the value is not represented as a non negative.

This method have parameter as the character to be find the numeric value as- getNumericValue('ch')

Example: GetNumericValue.java

package com.devmanuals;

public class GetNumericValue {

	public static void main(String[] args) {

		System.out.print("The Numeric value of A is= ");
		System.out.println(Character.getNumericValue('A'));
		System.out.print("The Numeric value of B is= ");
		System.out.println(Character.getNumericValue('B'));
		System.out.print("The Numeric value of G is= ");
		System.out.println(Character.getNumericValue('G'));

	}

}

Output:

The Numeric value of A is= 10

The Numeric value of B is= 11

The Numeric value of G is= 16

Download Thia Example.

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics