Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

Tokens in Java

Lesson 5 of 39 in the free Java notes on Siksha Sarovar, written by Rohit Jangra.

Tokens

The smallest unit of programming language which is used to compose the instruction is known as Token. There are 6 types:

  1. Keywords
  2. Identifiers
  3. Separators
  4. Comments
  5. Literals
  6. Operators

Keywords

• Predefined words which the java compiler can understand (e.g., class, public, static, void, if, else). • Always written in lower case. • There are ~53 keywords in Java.

Identifiers

The name given to the components of java by the programmer (Class name, Method name, Variable name).

Rules:

  1. Allowed characters: 'a-z', 'A-Z', '0-9', '_', '$'.
  2. Must start with letter, underscore, or dollar.
  3. Cannot start with a number.
  4. No spaces allowed.
  5. Cannot use keywords.

Conventions:Class: PascalCase (e.g., StudentData) • Method/Variable: camelCase (e.g., studentName, getDetails())

Separators

Curly Braces {}: Block start/end • Parentheses (): Method declaration/call • Square Brackets []: Arrays • Dot .: Package/Member access • Semicolon ;: End of statement • Comma ,: Separation