This data type is used to store a single character. The character must be enclosed within single quotes, like ‘P’ or ‘p’.
Example:
class CharExample {
public static void main(String[] args) {
char ak = ‘J’;
char a = 65, b = 66, c = 67;
System.out.println(ak); // prints J
System.out.println(a); // Displays 65
System.out.println(b); // Displays 66
System.out.println(c); // Displays 67
}}
(a); /em.out.println(b); // Displays .out.println(c); // Displays