Saturday 24 August 2013

DataTypes in JAVA

// siddhu vydyabhushana // 2 comments
What is Data Type?
Data types are common in any language (c, java,etc.,).It tells that the type of data in the variable or what type of value  is going to be stored .
For example: 

int number; // it will store only numericals
String word; //Store charchters
there are two types of data types in java 1.Primitive 2.Non-Primitive
Primitive sub divided into two types 1.Numeric 2.Non-Numeric Non-Primitive sub divided into two types 1.Array 2.Interface 3.Class

See Below Image:
datatypes in java

Numeric is subdivided into two types Integer, floating Point . Non Numeric is subdivided into two types Character ,Boolean.
Again Integer  subdivided into 4 types 1.byte 2.Int 3.Long 4.Short.

Primitive Data Types: it is also called a standard data type , intrinsic  or built-in data type.the java compiler contains detailed instructions on each legal operations supported by the data type.
there are 8 primitive data types, these classified into four groups.
NOTE: to find the range of numerical data types use the following formula


-2^(n-1) to +2^(n-1) - 1
Non-Primitive Data type:
it is also called derived type , Abstract data type (or) reference type .The derived data type built on the primitive data type.
Example: Class, Interface. the another good example is string datatype .
Java does not have any  unsigned types.the sizes of all numeic types are platform independent.

2 comments: