A char literal can be represented as single character with single quotes. Example: 1. char c=’a’; //(valid) 2. char c=”a”; //(invalid) 3. char c=a; //(invalid) 4. char c=’abc’; //(invalid)
Char literal can also be specified as integral literal. It represents Unicode of that character. Integral literals can specify either in decimal or octal or hexa decimal but allowed values range is 65535. Example: 1. char c=54; //(valid) 2. char c=65534; //(valid) 3. char c=65536; //(invalid)
Char literal can represent by Unicode representation which is nothing but ‘\uxxxx’ (4 digit hexa decimal number).