Data Types

Data is used to define the value which is to be stored for a variable. Type and size is to be determined in Data type.

Types of Data Types:


    •Data Type
    •Primitive
    •Integer
    •Floating
    •Character
    •Boolean
    •Non-primitive
    •ArrayList
    •Linklist
    •Stack

    •Queue
                                                      

  • Primitive Data Types: Primitive data types are already available in java environment. Size and range are fixed which can't be modified. It is divided into 4 Categories -


  1. Integer Types
  2. Floating-Point
  3. Character
  4. Boolean


Integer Types:

Data  Type
Size
Range
byte
1 byte
-128 to 127
short
2 bytes
-32,768 to 32,767
int
4 bytes
-2,147,483,648 to 2,147,483,647
long
8 bytes
-9223,372,036,854,755,808 to 9223,372,036,854,755,807

 Floating-point:

Data  Type
Size
Range
float
4 bytes
1.40e-45 to 3.40e+38
double
8 bytes
4.9e-324 to 1.8e+308

Character:

Data  Type
Size
Range
char
2 bytes
0 to 65,536

Boolean:

Data  Type
Size
Range
Boolean
1 bit
True or false


  • Non-primitive Data Type: Non-primitive data types doesn’t contain the  value but it holds the address to that value, that is why they are also called Reference variable also. Array, String, Stack are some examples of reference variables.

Comments

Popular posts from this blog

Decision Making Statements

What is JAVA?