Java Character charCount() method
The charCount() method of character class is used to determine the total number of char values needed to represent the specified character. As the name suggests, it counts the total char values.
The method requires a codePoint. A codePoint is a character to be tested.
If the given character is equal to or greater than 0X10000, the method returns 2. Otherwise the method returns 1.
Example 1Test it Now
The first object 59 can be represented by 1 char values The second object 1546719 can be represented by 2 char values
Example 2Test it Now
The value comes to be: 1 The value comes to be: 1 The value comes to be: 2
Enter the first number 67 The value comes to be: 1 Enter the second number 78 The value comes to be: 1 Enter the third number 2456789 The value comes to be: 2