4/03/2012

8 Primitive Type and their wrapper class

1. boolean  : 1 bit      Wrapper class: Boolean
    Cannot be cast to any other primitive types, vice versa.
2. byte : 1 byte, signed.  Wrapper class: Byte
    Covers values from -128 to 127.
3. short : 2 bytes, signed. Wrapper class: Short
    Covers values from -32,768 to 32,767

4. int : 4 bytes, signed.  Wrapper class: Integer
    Covers values from -2,147,483,648 to 2,147,483,647. 
    Can be cast into other numeric types (byte, short, long, float, double). 
    When lossy(downcast) casts are done (e.g. int to byte) the conversion is done modulo the length of the smaller type.
5. long : 8 bytes, signed.   Wrapper class: Long
    Covers values from -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807
6. float : 4 bytes, signed.   Wrapper class: Float
     Covers values from 1.40129846432481707e-45 to 3.40282346638528860e+38 (positive or negative).
7. double : 8 bytes, signed.   Wrapper class: Double
     Covers values from 4.94065645841246544e-324d to 1.79769313486231570e+308d (positive or negative).
8. char : 2 bytes, unsigned.   Wrapper class: Character
     Unicode, 0 to 65,535

No comments:

Post a Comment