Java.lang.Character.charValue() is a built-in method in Java that returns the value of this character object. This method converts the Character object into its primitive data type char.
public char charValue() The function does not accepts any parameter.
Return Type: This method returns the primitive char value represented by this object.
Below programs illustrate the Java.lang.Character.charValue() method:
Primitive char value is z
Program 2: When we assign the value of x by any digit:
Primitive char value is 9
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.