Java Character charCount() methodThe 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. SyntaxParameterThe method requires a codePoint. A codePoint is a character to be tested. Return ValueIf the given character is equal to or greater than 0X10000, the method returns 2. Otherwise the method returns 1. Example 1Output: The first object 59 can be represented by 1 char values The second object 1546719 can be represented by 2 char values Example 2Output: The value comes to be: 1 The value comes to be: 1 The value comes to be: 2 Example 3Output: 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 Next TopicJava-character-charvalue-method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India