Monday, October 10, 2011

Data Type

 The Primitive Types

Java has eight primitive types of data: byte, short, int, long, char, float, double, and boolean.
These can be put in four groups:
  1. Integers includes byte, short, int, and long
  2. Floating-point numbers includes float and double
  3. Characters includes char, like letters and numbers.
  4. Boolean includes boolean representing true/false values.
byte

     The smallest integer type
     a range from -128 to 127. 
     useful when working with a stream of data from a network or file. 
     Byte variables are declared by use of the byte keyword. 

     byte b, c;

int

    The most commonly used integer type
    a signed 32-bit type 
    Ranging from -2,147,483,648 to 2,147,483,647
    used to control loops and to index arrays. 
    the most efficient type

long

   a signed 64-bit type
 

No comments:

Post a Comment