Java Character charValue()MethodThe 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. SyntaxParameterNA Return ValueThe charValue() method of character class returns the primitive char value of the object. Example 1Test it NowOutput: The character value of char1 is = A The character value of char2 is = B Example 2Test it NowOutput: 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 3Test it NowOutput: 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
|