Page 20 - JAVA Programming
P. 20

19




               Java Data Types


                       Java  is  a  statically  typed  language.  The  base  of  any  programming
                       language is its data types and operators. Java comes with a rich set of
                       both data types and operators, which makes it suitable for any type of
                       programming.

               There are two categories of data types in Java:

                              1. Primitive Data Types

                              2. Non-Primitive Data Types

                   1.  Primitive Data Types

                       As  the  name  suggests,  the  programming  language  pre-defines  the
                       primitive data  types.  Primitive types are the most  basic  data  types
                       available in Java. There are 8 primitive data types in Java: byte, char,
                       short, int, long, float, double and Boolean. These data types act as
                       the basic building blocks of data manipulation in Java. Primitive data
                       types have a constraint that they can hold data of the same type and

                       have a fixed size. Primitive data types are also called intrinsic data
                       types. We can also perform operations on primitive data types.


                      All other types of data are derived from primitive data types.

                      Below diagram shows the complete chart of primitive data types –



                                          Primitive Data Types









                       Character               Integer             Floating-Point          Boolean




                         Char          byte     short   int     long     float    double     boolean
   15   16   17   18   19   20   21   22   23   24   25