Hi,
String:
is a Non-primitive data type and in actual is array.
Array is like we stack stuff somewhere with Last in First Out method. Likewise the data is stored in memory with the same method Byte by Byte. Therefore the size will vary depending upon the characters are given in a string.
However if you would want to know about the size of the string variable (veryuseful in programming as well) you can use
length() method.
Boolean:
In
java the length and code both are not described anywhere and
at all.
But through studies i guess it occupies the least memory of rest of the datatypes.
------------------