Computer Project
Computer Project
ITERATION IN JAVA
Submitted by:
[Your Name]
Submitted to:
[Teacher's Name]
[School/College Name]
[Academic Year]
DECLARATION
I hereby declare that the project entitled "Iteration in Java" submitted by me to [School/College
Name], is a record of my original work carried out under the guidance of [Teacher's Name]. This
project has not been submitted to any other institution for the award of any other degree, diploma, or
certificate.
Date: [Date]
Signature: _____________
This is to certify that the project titled "Iteration in Java" has been successfully completed by [Your
Name], Roll No. [Your Roll No.], under my guidance in partial fulfillment of the curriculum for the
Signature: ____________
(Teacher's Name)
[School/College Name]
Date: [Date]
TABLE OF CONTENTS
a) for loop
b) while loop
c) do-while loop
7. Conclusion ............................................................... 10
Introduction to Java
platform-independent language. Java is widely used for developing web applications, mobile apps,
One of the core concepts of Java is iteration, which allows repetitive execution of a block of code.
What is Iteration?
automating repetitive tasks. Java provides multiple constructs to implement iteration, commonly
known as loops.
Iteration helps reduce code redundancy, makes programs efficient, and is essential in handling data
1. for loop
Example:
System.out.println("Hello");
2. while loop
Example:
int i = 0;
while (i < 5) {
System.out.println("Hello");
i++;
3. do-while loop
Example:
int i = 0;
do {
System.out.println("Hello");
i++;
Also known as the for-each loop, it is used to iterate through arrays or collections easily.
Example:
System.out.println(num);
Nested Loops
Example:
Control Statements
Example:
if (i == 3) continue;
System.out.println(i);
}
Conclusion
repeated tasks efficiently. Understanding various loop constructs like for, while, do-while, and
enhanced for loop helps in writing clean and effective code. Mastery of iteration is essential for data