Primitive Data Types



Programming The main type of data types in JAVA are Integer, Floating point, Character and Boolean Details Integer Java provides four different integer types to accommodate different size numbers. All the numeric types are signed, which means that they can hold positive or negative numbers. The integer types have the following ranges: byte range is –128 to +127. Number of bits = 8. short range is –32,768 to +32,767. Number of bits = 16. int range is –2,147,483,648 to +2,147,483,647. The most common integer type is int. Number of bits = 32. long range is –9,223,372,036,854,775,808 to +9,223,372,036,854,775,807. Number of bits = 64. Floating Point The floating-point types hold numbers with a fractional part and conform to the IEEE 754 standard. There are two types of floating points: float and double. double is so called because it provides double the precision of float. A float uses 32 bits to store data, whereas a double uses 64 bits. Character The char type is used for individual characters, as opposed to a string of characters (which is implemented as a String object). Java supports Unicode, an international standard for representing a character in any written language in the world in a single 16-bit value. The first 256 characters coincide with the ISO Latin 1 character set, part of which is ASCII. Boolean The boolean type can hold either true or false. Note: true and false may appear to be keywords, but they are technically boolean literals.

Sent from Windows Mail

Popular posts from this blog

ch11 review silberschatz operating systems concepts essentials 2nd ed