Mega Code Archive

 
Categories / Java Tutorial / 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: Integers includes byte, short, int, and long Floating-point numbers includes float and double Characters includes char, like letters and numbers. 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