Latest web development tutorials

Java toString () method

Java Character class Java Character class


toString () method returns a String object representing the specified char value. The result is a string of length 1, only by the specified char composition.

grammar

String toString(char ch)

parameter

  • ch - the character to be converted.

return value

Returns a string representation of the char value.

Examples

public class Test {

	public static void main(String args[]) {
		System.out.println(Character.toString('a'));
		System.out.println(Character.toString('A'));
	}
}

The above program execution results:

a
A

Java Character class Java Character class