DATA TYPES
Data Types : Data Type specify the different sizes and values that can be
stored in the variable. It determines the size and kind of values that can be
stored and manipulated within a program. Java has two main data type.
(1). Primitive Data Type.
(2). User Defined ( Non- Primitive) Data Type.
Data Type
Primary (Primitive)
Non- Primitive
Class
Numeric Non- Numeric
Interface
Byte 1 8bit Char (2bit)
Arrays
Short (2byte) Bloolen (1bit)
String
Int (4 byte)
Long (8 byte)
Float 4byte
Double 8byte
1
Data Type Size Default Value Type of value stored
byte 1 byte = 8bits 0 Integral
short 2 byte 0 Integral
int 4 byte 0 Integral
long 8 byte 0L Integral
char 2 byte ‘\u0000’ Character
float 4 byte 0.0f Decimal
double 8 byte 0.0d Decimal
Boolean 1 bit (till JDK 1.3 it uses false True or False
1byte)