0% found this document useful (0 votes)
3 views21 pages

JPR Micro

Uploaded by

Yash Sawant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views21 pages

JPR Micro

Uploaded by

Yash Sawant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Sahyadri Shikshan Santha’s

SAHYADRI POLYTECHNIC SAWARDE

A
MICRO PROJECT
ON
_____________________________________________________
Submitted To
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION

IN THE PARTIAL FULFILLMENT OF THE REQUIRMENT FOR DIPLOMA IN


COMPUTER ENGINEERING / INFORMATION ECHNOLOGY

SUBMITTED BY

MR.SAWANT YASH MANGESH

MR. KHAN MOHAMMED SUZAN S.

MR. DABHOLKAR SANCHIT SACHIN

UNDER THE GUINDANCE OF

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:

TITLE OF PROJECT: java tokens

Sr Name of group Roll Enrollment Seat


No members Number Number Number
1 SAWANT YASH MANGESH 2410 2201080290
2 KHAN MOHAMMED 2411 2201080291
SUZAN S.
3 DABHOLKAR SANCHIT 2412 2201080292
SACHIN

Name of Guide: shinde P.A.


MAHARASHTRA STATE BOARD TECHNICAL
EDUCATION
Certificate
This is to certify that
Mr. SAWANT YASH MANGESH

Mr KHAN MOHAMMED SUZAN S.

Mr. DABHOLKAR SANCHIT SACHIN

Of 4th semester diploma in Computer Engineering /


Information Technology of Sahyadri polytechnic Sawarde
(Code:0108) has completed the Micro Project satisfactory in
subject JPR (22412) for the academic year 2024-25 as
prescribed in the curriculum.
Place: Sawarde Enrollment Number:
2201080290

2201080291

2201080292

Date: _______________ Exam Seat No:

Subject Teacher HOD principal


Micro project report
Title:- java tokens

1.0 Aim /benefits of the micro project


1.Readability and Understandability: Tokens make the code more
readable and easier to understand. They help in identifying the different
parts of the code, such as keywords, identifiers, literals, and operators.

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.

3.Code Generation: Tokens are used by the compiler to generate the


appropriate machine code or bytecode. The compiler uses the token
type to determine the appropriate operation or instruction to generate.

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.

5.Compiler Optimization: Tokens provide valuable information to the


compiler for optimization purposes. The compiler can use this
information to optimize the generated code for better performance.

2.0Course Outcomes Achieved :


1.Understanding the Basic Structure of a Java Program: By learning
about the different types of tokens in Java, such as keywords, identifiers,
literals, operators, and separators, students can gain a deeper
understanding of the basic structure of a Java program and how it is
broken down into meaningful units.

2.Identifying and Debugging Errors: Students can learn to identify and


debug errors in the code by understanding how tokens are used to
represent different parts of the code. This can help in identifying syntax
errors and other issues

3.Code Optimization: By understanding how tokens are used by the


compiler to generate machine code, students can learn to write more
efficient and optimized code.

4.Continued Learning: By understanding the concept of tokens in Java,


students can build a foundation for further learning of advanced Java
concepts.

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.

3.Debugging Exercises: Practice debugging code that contains errors


related to tokens. This will help you to identify the different types of
token errors and develop strategies for debugging and fixing them.

4.Compilation and Optimization: Learn about the role of tokens in code


compilation and optimization. Understand how the compiler uses tokens
to generate machine code and optimize the code for better performance.

5.Continued Learning: Continue learning about more advanced Java


concepts, such as classes, methods, and exception handling.
Understanding the basics of Java tokens will help you to build a
foundation for further learning and development.
6.Practice: Practice writing code that includes tokens in Java. This will
help you to become more familiar with the syntax and usage of tokens,
and will help you to write more efficient and error-free code.

 Actual Resources Used:


Sr Name of Resource/
Specification QTY Remark
No Material
Computer system 16 GB RAM, 1
1)
Windows 11
Internet Chatgpt /
2) wikipedia
Text book Software 1
3)
engineering
1.0 Brief Description:-

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.

class: Defines a class, which is a blueprint for creating objects.

static: Indicates that the method or variable belongs to the class rather
than an instance of the class.

void: Specifies that the method does not return a value.

if, else if, and else: Used for conditional statements.

for: Used for looping through a block of code a specific number of times.

int, String: Used to declare variables of different data types.

System.out.println(): Used to print output to the console.

for-each: Used to loop through the elements of an array.

Program:-
public class HelloWorld {

public static void main(String[] args) {

int number = 10;

String name = "John";

if (number > 0) {
System.out.println("The number is positive.");

} else if (number < 0) {

System.out.println("The number is negative.");

} else {

System.out.println("The number is zero.");

for (int i = 0; i < 5; i++) {

System.out.println("Hello, " + name + "!");

int[] numbers = {1, 2, 3, 4, 5};

for (int num : numbers) {

System.out.println("Number: " + num);

} }

2.0 Identifiers in Java


Identifiers in Java are symbolic names used for identification. They can be a class
name, variable name, method name, package name, constant name, and more.
However, In Java There are some reserved words that can not be used as an
identifier.

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 {

public static void main(String[] args) {

int number = 10;

String name = "John";

if (number > 0) {

System.out.println("The number is positive.");

} else if (number < 0) {

System.out.println("The number is negative.");

} else {

System.out.println("The number is zero.");

for (int i = 0; i < 5; i++) {

System.out.println("Hello, " + name + "!");

int[] numbers = {1, 2, 3, 4, 5};

for (int num : numbers) {

System.out.println("Number: " + num);

In this program, we use the following identifiers:

HelloWorld: The name of the class.


main: The name of the method.

args: The name of the parameter in the main method.

number: The name of the variable that stores an integer value.

name: The name of the variable that stores a string value.

i: The name of the variable used in the for loop.

num: The name of the variable used in the for-each loop.

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.

1.Integer literals: Integer literals can be represented in decimal,


hexadecimal, or octal format. By default, integer literals are treated as
decimal values. To specify a hexadecimal value, use the prefix 0x or 0X.
To specify an octal value, use the prefix 0. For example:
int decimal = 10; // decimal literal

int hexadecimal = 0x1F; // hexadecimal literal

int octal = 017; // octal literal

2.Character literals: Character literals are enclosed in single quotes


and can represent any Unicode character. To specify a Unicode
character, use the prefix \u followed by four hexadecimal digits. For
example:

char a = 'a'; // ASCII character

char euro = '\u20AC'; // Unicode character for Euro symbol

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:

String greeting = "Hello, world!";

String message = "This is a\nmulti-line\nstring.";

4.Boolean literals: Boolean literals can represent the values true or


false. For example:

boolean isStudent = true;


boolean isEmployee = false;

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.

Types of Operators in Java


There are multiple types of operators in Java all are mentioned below:

1.Arithmetic Operators:- These are used to perform arithmetic


operations on numerical values. For example

int x = 10;

int y = 5;

int sum = x + y; // addition

int difference = x - y; // subtraction

int product = x * y; // multiplication

int quotient = x / y; // division

int remainder = x % y; // modulus

int increment = ++x; // pre-increment

int decrement = --y; // pre-decrement

2.Relational operators: These are used to compare two values


and return a boolean value. For example:

int x =10;

int y = 5;

boolean isGreater = x > y; // greater than

boolean isLess = x < y; // less than

boolean isEqual = x == y; // equal to


boolean isNotEqual = x != y; // not equal to

boolean isGreaterOrEqual = x >= y; // greater than or equal to

boolean isLessOrEqual = x <= y; // less than or equal to

3.Logical operators: These are used to combine boolean


expressions and return a boolean value. For example:

boolean isStudent = true;

boolean isEmployee = false;

boolean isYoung = true;

boolean isOld = false;

boolean isEligible = isStudent || isEmployee && isYoung || !isOld;

4. Assignment operators: These are used to assign values to


variables. For example:

int x = 10;

int y = 5;

x = x + y; // addition

x += y; // shorthand addition

x = x * y; // multiplication

x *= y; // shorthand multiplication

5. Conditional operators: These are used to evaluate boolean


expressions and return a value based on the result. For
example:

int x = 10;

int y = 5;

int max = x > y ? x : y; // conditional operator

6. Bitwise operators: These are used to perform bitwise


operations on integer values. For example:

int x = 10; // 1010 in binary

int y = 5; // 0101 in binary

int result = x & y; // bitwise AND

int result = x | y; // bitwise OR

int result = x ^ y; // bitwise XOR

int result = ~x; // bitwise NOT

int result = x << y; // bitwise left shift

int result = x >> y; // bitwise right shift

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.

Java has several types of separators, each with a specific use.


The most commonly used separators include the semicolon (;),
comma (,), dot (.), and colon (:).

Understanding and properly using separators is important in


writing clear and efficient Java code. It allows for a consistent
and organized structure, making it easier for other developers
to understand and work with the code.
Example:-

6.0 Java Comments


The Java comments are the statements in a program that are
not executed by the compiler and interpreter.
1.Single-line comments: These are used for brief explanations
or annotations. They start with two forward slashes (//) and
continue until the end of the line.

Example:

int myVariable = 5; // This is a single-line comment

2.Multi-line comments: These are used for more detailed


explanations that span multiple lines. They start with /* and end
with */.

Example:

/*

This is a multi-line comment.

It can span multiple lines.

*/

3. Documentation comments (Javadoc): These are used to


generate documentation for your code. They start with /** and
end with */. Javadoc comments can include tags
like @param, @return, and @throws to describe the
functionality of methods.

Example:
/**
* This is a Javadoc comment.

* It can span multiple lines.

* @param myParameter The parameter description.

* @return The return value description.

* @throws MyException The exception description.

*/

public void myMethod(String myParameter) throws MyException {

// Method implementation

}
Evaluation Sheet for the Micro Project
Name of Student :- Enrollment No:-

SAWANT YASH MANGESH 2201080290

KHAN MOHAMMED SUZAN S. 2201080291

DABHOLKAR SANCHIT SACHIN 2201080292


th
Name of Program: CO Semester:4
Course Title:-JPR Code:22412
Title of Micro Project:- java tokens
Course Outcomes:-1. Understanding Java Syntax: Students will gain a deep
understanding of Java syntax, including the role of tokens in forming valid Java
statements and expressions.
2.Recognition of Tokens: Students will be able to recognize and
classify different types of tokens in Java code, such as identifiers, keywords, literals,
operators, separators, and comments.
Poor Average Good Excellent
Sr
Characteristics to be assessed (Marks 1- (Marks4- (Marks 6- (Marks 9-
No
3) 5) 8) 10)
1 Relevance to the course
2 Literature survey / Information collection
Completion of the target as per project
3
proposal
4 Analysis of data and representation
5 Quality of prototype / Model
6 Report Presentation
(A) Process and Product Assessment (Convert above total marks out of 6 marks)
8 Presentation
9 Viva
(B) Individual Presentation /Viva (Convert above total marks out of 4 marks)

(A)
(B) Individual Presentation / Viva Total
Process and Product Assessment
(4 marks) marks 10
(6 marks)

Comments/Suggestions above team work/leadership/inter-personal communication (if any)

Name and designation of the Teacher

Dated Signature:

You might also like