Page 64 - CA_Blue( J )_Class9
P. 64

byte                extends             int                 short               true
                   case                false               interface           static              try
                   catch               final               long                strictfp            void
                   char                finally             native              super               volatile

                   class               float               new                 switch              while
                   const               for                 null                synchronized        continue
                   default             goto                package             private             this
                   abstract            do                  if


                        Note: The "const" and "goto" keywords are not used in Java, but they are reserved for potential future
                        use.



                  4.4.2 Identifiers
                  In Java, identifiers are used to represent user-defined names, such as the names of variables, methods, classes, and
                  other user-defined entities. An identifier can be a combination of letters, digits, underscores (_), and dollar signs ($). It
                  must start with a letter (either lowercase or uppercase), an underscore (_), or a dollar sign ($). However, an identifier
                  cannot start with a digit. You cannot use Java keywords as identifiers. Keywords are reserved for special use in the
                  language. Identifiers must be unique, and if two identifiers differ only by case (e.g., age and AGE), they are considered
                  different. After an identifier is declared, it can be used throughout the program to refer to the associated value.
                  Identifier Naming Conventions
                  Following are some protocols that are followed while naming the identifiers:

                  •  An identifier must start with a letter (a–z or A–Z) or underscore (_) or dollar ($).
                  •  An identifier can not start with a digit. However, apart from the first character, it can have any combination of
                     letters or digits.
                  •  An identifier is case sensitive which means “AGE” and “age” are two different identifiers.
                  •  An identifier can be of any length.
                  •  An identifier cannot contain whitespaces.
                  •  An identifier cannot be a Java keyword.
                  •  An identifier must not contain any type of special symbol apart from $ and _.
                  Examples of valid Identifiers:

                  Name, $add, _cost, marks_computer, country_91, etc.
                  Examples of  invalid Identifiers:

                  1.  91_country - cannot start with number.
                  2.  cost price  - cannot contain space within.
                  3.  s+p       - cannot contain any type of special symbol apart from $ and _.
                  4.  class     - cannot use any keyword.


                                                              Definition


                          Identifiers are the names given to different components of a Java program like class, variables
                          and methods.



                    62    Touchpad Computer Applications-IX
                  Literals
   59   60   61   62   63   64   65   66   67   68   69