Javatpoint Logo
Javatpoint Logo

Java Character charValue()Method

The charValue() method of character class is used to determine the char value of the object. This method is used to convert the Character object into its primitive data type char.

Syntax

Parameter

NA

Return Value

The charValue() method of character class returns the primitive char value of the object.

Example 1

Test it Now

Output:

The character value of char1 is = A
The character value of char2 is = B

Example 2

Test it Now

Output:

The primitive char value of a is: 1
The primitive char value of b is: 2
The primitive char value of c is: 3
The primitive char value of d is: 4
The primitive char value of e is: 5

Example 3

Test it Now

Output:

Primitive char value is z
Primitive char value is e
Primitive char value is r
Primitive char value is o
z   e    r    o
Next TopicJava Character



Please Share

facebook twitter google plus pinterest