Char

public class Main {
    public static void main(String[] args) {
        char myChar1 = 'C';
        char myChar2 = '\u00A9';
        System.out.println("myChar1 = " + myChar1);
        System.out.println("myChar2 = " + myChar2);
    }
}

The snippet result is

myChar1 = C

myChar2 = ©

You can assign a single character to the char type variable. You could also use the Unicode system to represent a character.

Unicode Character Table

Last updated