Understanding char data type
The java char data type and its possible values are explained here.
- Declaration and initialisation of char type with different possible values.
Java allows to store the 0 value (null value) also in character type. It doesn’t have special significance is in C/C++.
The non-displayable character values like integer value for control character newline (LF) can also be directly stored.
This is the first displayable ascii character after space which is the character !
This is first uppercase alphabet the decimal value for A.
This is the last 7-bit ascii displayable character ~ .
This is the largest 8 bit character which will be displayed as per the output device capability.
This is the largest character value to be stored. This will not display anything with normal print commands unless we define proper encoding etc.
This is the usual single quote based initialisation of character
This is unicode style initialisation. The current case has been shown for character (pi) .
- char data type in java is unique in terms of having only positive values as against the short integer type data which is also 16 bit but it can have both positive and negative values.
Suggested Filename(s): CharType.java
sunmitra| Created: 19-Mar-2018 | Updated: 19-Mar-2018|