DEV Community

Cover image for What Are the Tokens In JAVA
Roshan Shambharkar
Roshan Shambharkar

Posted on

What Are the Tokens In JAVA

What are the tokens in JAVA.
Tokens:- Tokens are the smallest unit of programming language which helps the the programmer to create instructions

Tokens are two types
1- Keyword:-
2- Identifier:-

Keyword:-

  1. compiler aware words are called keyword

  2. Keyword have predefine meaning and cannot be altered by programmer's

  3. All Keywords are written low case.

Identifier:- Identifier are the names given by the programmer to the members of java such as class name, method name, variable name, interfaces name, packages etc.

There are certain rule to follow while naming the identifiers
if the rules are not followed we get complie time error(rules are checked by complier)

Rules to name Identifier
1- An Indentifire cannot start with number
e.g 1Programm
Program1

2- Character spaces are not allowed while naming the identifiers
e.g My First Program
MyFirstProgram

3- Special character are not allowed while naming the Identifiers other than '$' and '_'
e.g $Programs
_Program

4- Keyword cannot be used in Place of Identifiers

Top comments (0)