Page 58 - iPlus_Ver_2.0_class_8
P. 58

Examples of some valid identifier names are Employee123, mygood_book, _address93, FirstName,
                  age, etc.
                  Examples of some invalid identifier names are 1_Name, @Address, 1234, –Age, etc.

                  Keywords

                  Keywords are the reserved words that cannot be used as identifier names as they carry a special
                  meaning for the Java compiler. Some of the Java keywords are given below:

                                                            Java Keywords
                   abstract            const               float               interface           static

                   boolean             continue            for                 long                switch
                   break               default             goto                new                 this

                   byte                do                  if                  private             throw
                   case                double              implements          protected           throws
                   catch               else                import              public              try
                   char                extends             instanceof          return              void

                   class               final               int                 short               while

                  The keywords const and goto cannot be used in Java. They were added to the list of keywords so
                  that they would generate compiler errors for developers who were converting C and C++ code
                  over to Java.

                  There are three more reserved words in Java: true, false, and null. Technically, they are literal
                  values and not keywords. However, they cannot be used as identifiers, and they have a specific
                  meaning to the Java compiler.

                  Data Types

                  A data type is used to define the size and type of value that a variable can store. The Java
                  language  is rich  in  its data  types.  Java  provides  two  types  of  data  types:  primitive  and
                  non-primitive.
                  Primitive Data Types

                  Java provides eight basic data types, which are as given in the following table:

                   Data Type       Size (in bits)          Minimum Value                    Maximum Value

                   byte         8                   –128                             127
                   short        16                  –32768                           32767
                   int          32                  –2147483648                      2147483647
                   long         64                  –9223372036854775808             9223372036854775807
                   char         16                  0                                65535
                   float        32                  1.4E –45                         3.4028235E38
                   double       64                  4.9E –324                        1.7976931348623157E308

                   boolean      1                   True or false



                    56
                         iPlus (Ver. 2.0)-VIII
   53   54   55   56   57   58   59   60   61   62   63