Tokens in Java

Kishore V

 JAVA Tokens

Java tokens are smallest individual units in a program

Keywords: 

• These are the pre-defined reserved words of any programming language.
• Each keyword has a special meaning.
• It is always written in lowercase.
e.g. class, while, for, interface, abstract…..

Identifier:

•  Identifiers are used to name a variable, constant, function, class, and array.
•  It is usually defined by the user.
•  It uses letters, underscores, or a dollar sign as the first character.
•  Identifier names must be different from the reserved keywords.

Literals: 

•  Literal is a notation that represents a fixed value (constant) in the source code.
•  It can be categorized as an integer literal, string literal, Boolean literal, etc.
•  It is defined by the programmer.

operators: 

•  Operators are the special symbol to perform mathematical operations or logical manipulations
•  Java provides different types of operators that can be classified according to the functionality they provide.

Comments:

Comments are used to describe the program
•   Single Line Comment (// Double Slash)
// This is an example program to add two numbers
// Java program to illustrate the addition of numbers
•          Multi-line Comment (/*     */)
/*This is an example
 program to
add two numbers */

Constants

❑      Constants are the fixed values that never change during the execution of a program.

  
 
Our website uses cookies to enhance your experience. Learn More
Accept !

GocourseAI

close
send