-->
Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Sunday, May 28, 2017

Tokens in Java:Identifiers|Literals|Keywords|Punctuators|Operators

Tokens
The smallest individual part or unit in a program is known as tokens.

Java has five kinds of tokens:
  • Keyword
  • Identifiers
  • Literals
  • Punctuators
  • Operators
Keywords
Keywords are the special reserved word in Java which conveys some special meaning to the compiler so they cannot be used as identifiers(names) for classes, methods, or variables.

Identifiers
Identifiers are user defined tokens.They are used for naming classes, methods, variables, packages and interface in a program.

Rules for Identifiers:
  • Can consist of Alphabets, digit, underscore and dollar
  • Must not start with a digit
  • Case sensitive
  • Can be of any length
 Literals
A Java literal is a sequence of character that represents constant value that is to be stored in a variable.

Java specifies 5 major Literals 
  1. Integer Literal
  2. Floating Point Literal
  3. Character Literal
  4. String Literal
  5. Boolean Literal
Punctuators 
The following ASCII characters are used as separators in Java
( )
{ }
[ ]
;
,

Operators
The following are the operators in Java

 

No comments:

Post a Comment