Java Char

char datatype

Unlike a String which, in Java, is an actual object with a full blown class, a char is a primitive datatype and represents a single character. While a String could have a single character, two characters or more, a char is limited to a single character. You use single quotes to designate a char as in the example below.

Examples of properly declared and initialized chars.


Examples of improper chars.

site map | resources