Java-Character

Character

A single character that is written inside single quotation marks is defined as a character constant. The default size that is made available for a char type constant is 2 bytes. A char type variable can store only a single character.

Program

1


Program Source

class Javaapp {

    public static void main(String[] args) {
        
        char ch1 = '5';
        char ch2 = 'Z';
        System.out.println("ch1 = "+ch1);
        System.out.println("ch2 = "+ch2);
    }
}

Leave a Comment