Tuesday, 25 June 2013

Primitive Data Type

Intro

The amount of value that can hold by a variable is know as data types. There are two main types in programming language. 

1. Primitive Data Type.
2. User Defined Data Type.

Here some introduction about Java language primitive data type. Java programming language supports 8 primitive data types. A primitive type is named by a reserved keyword. Primitive values do not share state with other primitive values.

byte

The byte data type is an 8-bit signed two’s complement (http://en.wikipedia.org/wiki/Two's_complement) integer. The byte data type can be useful for saving memory in large arrays.

byte Range ::: minimum value : -128 , maximum value : 127
Default Value : 0

short

The short data type is a 16-bit signed two’s complement (http://en.wikipedia.org/wiki/Two's_complement) integer. You can use a short to save memory in large arrays. 

short Range ::: minimum value : -32,768, maximum value : 32,767
Default Value : 0

int 

The int data type is a 32-bit signed two’s complement integer. It has a minimum value of
-2,147,483,648 and a maximum value of 2,147,483,647.

int Range ::: minimum value : -2,147,483,648, maximum value : 2,147,483,647
Default Value : 0

long

The long data type is a 64-bit signed two’s complement (http://en.wikipedia.org/wiki/Two's_complement) integer.

long Range ::: minimum value : -9,223,372,036,854,775,808, maximum value :
9,223,372,036,854,775,807
Default Value : 0L

float 

The float data type is a single-precision (http://en.wikipedia.org/wiki/Single_precision_floatingpoint_
format) 32-bit IEEE 754 (http://en.wikipedia.org/wiki/IEEE_754-2008) floating point.

Default Value : 0.0f

double

The double data type is a double-precision (http://en.wikipedia.org/wiki/Double_precision_floatingpoint_
format) 64-bit IEEE 754 (http://en.wikipedia.org/wiki/IEEE_754-2008) floating point

Default Value : 0.0f

boolean

The boolean data type has only two possible values: true and false.

Default Value : 0.0d

char

The char data type is a single 16-bit Unicode character (http://en.wikipedia.org/wiki/Unicode).
char Range ::: minimum value : ‘\u0000', maximum value : ‘\uffff’

Default Value : ‘\u0000’

No comments:

Post a Comment