DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 963,673 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
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)

🌚 Life is too short to browse without dark mode