Page 67 - CA_Blue( J )_Class9
P. 67

4.4.4 Punctuators
                 Punctuators are special characters in Java used as punctuation signs. Some of the punctuators are:
                 •  ‘?’  (question mark)
                 •  ‘:’  (colon)
                 •  ‘;’  (semicolon)
                 •  ‘.’  (dot)

                 In Java, each and every statement ends with ‘;’ and known as statement terminator. So, it is treated as an important
                 punctuator.


                 4.4.5 Separators
                 Separators are the special characters used to separate the variables or characters in a Java Program. Some of the
                 separators are:

                     Name        Separator                                 Description
                 Comma               ,        Used to separate multiple variables under the same declaration
                 Brackets            ( )      Used to enclose any relational or mathematical expressions.
                 Curly Braces        { }      Used to enclose a group of statements under a single statement.
                 Square Braces       [ ]      Used to enclose the index number or cell number of a dimensional array.

                     4.5 DATA TYPES
                 A data type is an attribute of data which tells the compiler or interpreter how the programmer intends to use the
                 data or value. It specifies the size and type of values that can be stored in an identifier. Different data types allow
                 you to select the type appropriate to the needs of the application. Data types in Java are classified as shown below.


                                                                         DATA TYPE



                                                 Primitive Type                              Non-Primitive Type



                         Boolean         Character          Integer       Real/Decimal                   Arrays

                          double           Char                                                          Class
                                                                         float    double
                                                                                                        Interface
                                                                  byte
                                                                                                         String
                                                                  short

                                                                   int
                                                                  long


                 4.5.1 Primitive Data Types
                 Primitive data types are predefined or built-in data types and is named by a reserved keyword. They are also called
                 basic data type. The eight primitive data types supported by the Java programming language are byte, short, int,
                 long, float, double, boolean and char. Each data type occupies a fixed size in memory.

                 Integer Type
                 Integer types can hold whole numbers such as 123, -96, etc. The size of the values that can be stored depends on
                 the integer type that we choose. Valid types are  byte,  short,  int  and  long.



                                                                                               Values and Types  65
   62   63   64   65   66   67   68   69   70   71   72