Java Data Types

There are two types of datatypes :- 

                                                         1) Primitive Datatypes

                                                     2) Non-Primitive Datatypes


1) Primitive Data Types :

            - Java provides eight primitive types of data.

            - 1) byte                    2) short

            - 3) int                       4) long

            - 5) char                    6) float

            - 7) double                8) boolean

         

            - The primitive types are also commonly referred to as simple types.

            - These can be put in four groups :- 

                                                                     1) Integer

                                                                     2) Floating Point numbers

                                                                     3) Character

                                                                     4) Boolean


Integer :

                     - Java provides four integer types : byte , short , int , long.

                       - All of these are signed , positive and negative values.


primitive-datatypes-integer-table
                


Floating Point Types :

                                                        - Floating point number ,also known as real numbers.

                                                        - There are two kinds of floating-point types :- 

                                                                 float

                                                                 double

                                                        - Which represent single and double-point numbers respectively.

                

float-datatype-table


Character : 

                            - The datatype used to store characters is char.
                            

character-datatype-table



Boolean :

                 - Java has primitive type called boolean ,for logical values.

                         - It can have only one of two possible values , true or false.


                        

boolean-datatype-table

Comments