Tokens

A program is a set of instructions to be executed by the computer to accomplish a particular task. While writing a program one has to take care of data which the program will process and generate information.

 

TOKENS

   Token=Identifiers ,keyword, separator, operators, literal, comments

   Identifier, keyword, separator, operators, literal, comments are the building block of Java programming which are used to write a program in java .Programming are written with the help of TOKENS…………… The examples of these are:

Identifier---sum, total, per;(names given to function, variables etc)

Keyword---int, switch, char;(are predefined or reserved with special meaning like int is used for integer

Separator--,(comma);(semicolon)

Operator--Arithmetic(+,-,*,/,%) Relational(>,<,>=,<=)Logical(&&,||,!)(Symbolic representation)

Literals--integer(2,3),floating value(2.3.3.6)ex(int a=4)means 4 is the integer literal.

Commentsàuse for programmer not for compiler means if you want to write the definition of a                                                                                                                                                                  program or details of a program then use comments)

           a)SingleLine--(//use for single line not for multi line)

           b)MultiLine-- (/*-----*/ for more than one line explaination)

/*example of java tokens*/

class javatokens       //class definition

{                                

public static void main(String aa[])     //main function

{                           //beginning ( for arithmetic calculation(any type of calculation )                          

int a, b, c;             //variable declaration int is the data type(keyword) a, b, c are the variables(identifier)

a=12;                             //constant value and end of the statement or we can say separator(;)

b=3;

c=a+b;                         //arithmetic operator

System.out.print(c); //for output

}                        // main end

}                     //class end