Java Tokens

In this session i have discussed Tokens in Java .

A Token is a smallest individual unit in java program that is meaningfull to the compiler . It can be classified as following .

1-Keywords (eg. int , float etc)

2-Identifiers (eg. name , x , y)

3-Constants (eg. 10 , 20)

4-Strings (eg. "total","Ram")

5-Special Symbols (eg. [] , {})

6-Operators (eg. + , - / , *)

1-Keywords :

Keyword is a predefined or reserved word in java . You can not use the keyword as variable name .

We have already learned the keyword in details . Pls click on Keyword link for more info .

2-Identifiers :

Identifiers refers names such as variable , function , class etc in Java .

Identifiers identifies the entities like variable , function , structure etc in Java .

We have already discuss the identifier . Pls for more info click on Identifier link .

3-Constants :

Constants are the values assigned to variable in java program . It is also called literal . There are many types of literal given below .

3.1-Integer Literals .

3.2-Real Literals .

3.3-Single Character Literals .

3.4-String Literals .

3.1-Integer Literals :

Integer Literals refers to digits . They can be divide into two categories such as decimal integers(123,987654321) and hexadecimal integers(0x2,0x9F) .

3.2-Real Literals :

Real Literals are represented by the number containg the fractional parts like 20.34 etc .

3.3-Single Character Literals :

The Single Character Literals are represented by the character in pair of single quote marks like 's' , '5' etc .

3.4-String Literals :

The String Literals is represented by the sequence of character in pair of double quote marks like "hello" , "abc" etc .


The String Literals is represented by the sequence of character in pair of double quote marks like "hello" , "abc" etc

5-Special Symbol

There are some useful special symbols as follows .


It is used in array for element reference .

5.2-Curly Bracket{}

The opening and ending curly braces marks the start and end of a block of code containing more than one executable statement. It is also use in switch case function etc .


It is used to indicate function calls and function parameters.


An operator is a symbol that tells the compiler to perform a certain mathematical or logical manipulation. Operators are used in programs to manipulate data and variables . The value or variable is called the operand on which the operators perform action .

 public class Hello{ 
      public static void main(String args[]){  
            int x=20,y=10;
            int sum=x+y;
            System.out.println("Sum : "+sum);  
    OUTPUT : Sum : 30

the + is operator . x and y is the operand .

We will discuss the operator details in next chapter .

Welcome to AndroidATPoint.

back image                     next image