Identifiers Literals And Keywords In Java

TOKENS IN JAVA:

Literals :

Literals in Java are a sequence of characters (digits, letters and other characters) that characterize constant values to be stored in variables. Java language specifies five major types of literals are as follows :

  • Integer literals
  • Floating point literals
  • Character literals
  • String literals
  • Boolean literals

Identifiers :

Identifiers are programmer-created tokens. They are used for naming classes, methods, variables, objects, labels, packages and interfaces in a program. Java identifiers follow the following rules:

  • They can have alphabets, digits, and the underscore and dollar sign characters.
  • They must not start with a digit.
  • Uppercase and lowercase letters are individual.
  • They can be of any length.

Identifier must be meaningful, easily understandable and descriptive.

For example :
Private and local variables like “length”. Name of public methods and instance variables begin with lowercase letter like “addition”

Keywords :

Keywords are important part of Java. Java language has reserved 50 words as keywords. Keywords have specific meaning in Java. We cannot use them as variable, classes and method. Following table shows keywords.

abstract char catch boolean
default finally do implements
if long throw private
package static break double
this volatile import protected
class throws byte else
float final public transient
native instanceof case extends
int null const new
return try for switch
interface void while synchronized
short continue goto super
assert const
#identifiers_in_java #literals_in_java #keywords_in_java #tokens_in_java #java_keywords

(New page will open, for Comment)

Not yet commented...