DATA TYPES
Data types are the domains which determine what type of
contents can be stored in a variable.
1. Primitive
data types
2. Reference
data types
1. Primitive Data Types:
Primitive
data types are non-grouped pieces of data which can have only one value at a
time. They are the simplest built in forms of data in Java. Other data types
are made up of combination of primitive data types.
The primitive data type
keywords are as shown:
Primitive data types: In java we have 8 primitive data types, they
are as follows
Byte
:
it is used to store an integer value up to 8 bits (-2^7 to 2^7-1).
Short
:
it is used to store an integer value up to 16 bits (-2^15 to 2^15-1).
Int
:
it is used to store an integer value up to 32 bits (-2^31 to 2^31-1).
Long
:
it is used to store an integer value up to 64 bits (-2^63 to 2^63-1).
Float : it is used to store a decimal value
up to 32 bits.
double : it is used to store a decimal value
up to 64 bits.
Boolean: it is used
for storing Boolean values like either TRUE or FALSE.
Char
:
it is used for storing a single character.
Reference Data Types
Reference data
types are made by the logical grouping of primitive data types. These are
called reference data types because they contain the address of a value rather
than the value itself. Arrays, objects, interfaces etc. are examples of
reference data types.
No comments:
Post a Comment