JPR Micro
JPR Micro
A
MICRO PROJECT
ON
_____________________________________________________
Submitted To
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
SUBMITTED BY
Shinde P.A.
2024-2025
SAHYADRI POLYTECHNIC SAWARDE
MICRO PROJECT
Academic Year: 2024-2025
TITLE OF PROJECT
Java tokens
Program: CO Program Code:4th
Course: JPR Course Code:22412
Group Details:
2201080291
2201080292
2.Error Detection: Tokens play a crucial role in error detection during the
compilation process. The compiler can easily identify and report syntax
errors in the code.
4.Lexical Analysis: Tokens are the result of lexical analysis, which is the
first phase of the compiler. Lexical analysis involves breaking down the
source code into tokens to prepare it for parsing.
3.0Action Plan :
1.Research and Study: Start by researching the different types of tokens
in Java, such as keywords, identifiers, literals, operators, and separators.
Read the Java documentation and other resources to understand the
syntax and purpose of each type of token.
2.Code Examples: Practice writing code examples that include each type
of token in Java. This will help you to understand how tokens are used in
practice and how they can be combined to create more complex
expressions.
The Java compiler breaks the line of code into text (words) is called
Java tokens. These are the smallest element of the Java program. The
Java compiler identified these words as tokens. These tokens are
separated by the delimiters. It is useful for compilers to detect errors.
Remember that the delimiters are not part of the Java tokens.
TOKENS IN JAVA:-
1.keywords
2.Identifiers
3.Literals
4.Operators
5.Separators
6.Comments
1.0 Keywords:-
java keywords are also known as reserved words. Keywords are
particular words that act as a key to a code. These are predefined words
by Java so they cannot be used as a variable or object name or class
name.
Example:-
public: Indicates that the class and its methods can be accessed from
any package.
static: Indicates that the method or variable belongs to the class rather
than an instance of the class.
for: Used for looping through a block of code a specific number of times.
Program:-
public class HelloWorld {
if (number > 0) {
System.out.println("The number is positive.");
} else {
} }
For every identifier there are some conventions that should be used before declaring
them. Let's understand it with a simple Java program:
Program:-
public class HelloWorld {
if (number > 0) {
} else {
3.0 Literals:-
In Java, literal is a notation that represents a fixed value in the source
code. In lexical analysis, literals of a given type are generally known as
tokens. In this section, we will discuss the term literals in Java.
3.String literals: String literals are enclosed in double quotes and can
represent a sequence of characters. String literals can include escape
sequences, such as \n for newline or \t for tab. For example:
4.0 Oprators:-
Operators in Java are the symbols used for performing specific
operations in Java. Operators make tasks like addition, multiplication,
etc which look easy although the implementation of these tasks is quite
complex.
int x = 10;
int y = 5;
int x =10;
int y = 5;
int x = 10;
int y = 5;
x = x + y; // addition
x += y; // shorthand addition
x = x * y; // multiplication
x *= y; // shorthand multiplication
int x = 10;
int y = 5;
5.0 Separators
In Java, separators are characters that separate different parts
of a code statement or expression. They play an important role
in defining the language's syntax and help to organize and
structure code in a readable and understandable way.
Example:
Example:
/*
*/
Example:
/**
* This is a Javadoc comment.
*/
// Method implementation
}
Evaluation Sheet for the Micro Project
Name of Student :- Enrollment No:-
(A)
(B) Individual Presentation / Viva Total
Process and Product Assessment
(4 marks) marks 10
(6 marks)
Dated Signature: