java2db

Character and boolean primitive data types in java



Character and boolean primitive data types Character Data Types:

It can hold a single character (Example : a, S, &, * ,…)  enclosed with single quotes (Ex : ‘a’).

Data type Memory Size Min and Max Values
char 2 bytes 0 to 65535

Note : It can also  store a number in between the range of 0 to 65535 .

Syntax :

char <variable_Name> = <single char value>‘   or

char <variable_Name> = <number in between the range of 0 to 65535>;

Example :

 

 

 

Character and boolean primitive data types Boolean Data Types:

Boolean data type represents either true or false.The JVM allot 1 bit of memory to store a boolean value internally.

Data type Memory Size Min and Max Values
boolean 1 bit size is not precisely defined

Syntax:

boolean <veriable_Name> = <either true or false>;

Example :

 

 

 

Example for Character and boolean primitive data types:

Execution Result:

Character and boolean primitive data types The String class is not technically a primitive data type, but considering the special support given   to it by the language.




Related Posts :
What are the primitive data types in java
   [will not be published]



^ <