Java Character toString() MethodThe toString() method of Character class returns the String object which represents the given Character's value. The obtained result is typically a string with length 1 whose component is a primitive char value that represents the Character object. SyntaxReturn ValueThe toString()method returns the string representation of the given character. Example 1Test it NowOutput: The string value of r is: r The string value of 9 is: 9 Example 2Test it NowOutput: The string value of A is: A The string value of 7 is: 7 Java Character toString(char c)MethodThe toString(char c) method of Character class returns the String object which represents the given Character's value. The obtained result is typically a string with length 1 whose component is a primitive char value that represents the Character object. SyntaxParameterc: It is the character that needs to be tested. Return ValueThe toString(char c) method returns the string representation of the given character. Example 1Test it NowOutput: The string value of V is given as:V The string value of v is given as: v Example 2Test it NowOutput: The string value of f is given as:f The string value of e is given as: e
Next TopicJava Character
|