Data Type Range And Values, Wrapper Class

 Integer Types

        Integer data types are byte, short, int,  long

Ex:   

     byte a = 127 ;

     short b = 32767;

     int c = 2147483645 ;
 
     long  d = 9223372036854775807L;  

Data Type    

Width(bits)    

Minimum value MIN_VALUE        

Maximum value MAX_VALUE

byte

8

-27 (-128)

27-1 (+127)

short

16

-215 (-32768)

215-1 (+32767)

int

32

-231 (-2147483648)

231-1 (+2147483647)

long

64

-263 (-9223372036854775808L)

263-1 (+9223372036854775807L)


Character Type

    Characters are represented by the data type char
            

Data Type    

Width (bits)    

Minimum Unicode value    

Maximum Unicode value

char

16

0x0 (\u0000)

0xffff (\uffff)


    Ex:

        char a = 'D'
       char let = 'B'


Floating-point Types

    Floating-point numbers are represented by the float and double data types.

Data      Type 

Width      (bits)

Minimum Positive Value       MIN_VALUE

Maximum Positive Value MAX_VALUE

float

32

1.401298464324817E-45f

3.402823476638528860e+38f

double

64

4.94065645841246544e-324

1.79769313486231570e+308


Ex:

      float length  = 12.12f ;
     double width = 3232.323232 ;

Boolean Type

    boolean have the two logical values denoted by the literals true and false

    

Data Type 

    Width 

True Value Literal     

False Value Literal

boolean

                        not applicable    

true    

false


   Ex:    
 
     boolean yes = true;
     boolean no = false; 


Summary of Primitive Data Types & Wrapper Class

Data Type    

Width (bits)    

Minimum Value, Maximum Value        

Wrapper Class            

boolean

not applicable

true, false (no ordering implied)

Boolean

byte

8

-27, 27-1

Byte

short

16

-215, 215-1

Short

char

16

0x0, 0xffff

Character

int

32

-231, 231-1

Integer

long

64

-263, 263-1

Long

float

32

±1.40129846432481707e-45f,

 ±3.402823476638528860e+38f     

Float

double

64

\'b14.94065645841246544e-324,

 \'b11.79769313486231570e+308 

Double












Post a Comment

Previous Post Next Post

Featured Post