Different types of data in java.
Java defines eight simple (or elemental) types of data: byte, short, int, long, char, float,
double, and boolean. These can be put in four groups:
■ Integers This group includes byte, short, int, and long, which are for wholevalued
signed numbers.
byte => 8 bits
short => 16 bits
int => 32 bits
long => 64 bits
■ Floating-point numbers This group includes float and double, which represent
numbers with fractional precision.
Float => 32 bits
Double => 64 bits
■ Characters This group includes char, which represents symbols in a character
set, like letters and numbers.
Char => 16 bits
Java uses Unicode to represent characters. Unicode defines a fully international character set that can represent all of the characters found in all human languages. It is a unification of dozens of character sets, such as Latin, Greek, Arabic, Cyrillic, Hebrew, Katakana, Hangul, and many more. For this purpose, it requires 16 bits. Thus, in Java char is a 16-bit type.
■ Boolean This group includes boolean, which is a special type for representing true/false
values.
Comments
Post a Comment