Skip to header Skip to main navigation Skip to main content Skip to footer

User account menu

  • Log in
Home
COPA
Computer Operator and Programming Assistant

Main navigation

  • Home
    • COPA Assessment Criteria
    • COPA Job Role
    • Course Information
  • Books
  • Question Paper
  • Syllabus

Loop control flow using while – do, do – while loops, for loop, using the break, continue statements

Breadcrumb

  • Home
  • Introduction to Programming in Java
  • Loop control flow using while – do, do – while loops, for loop, using the break, continue statements

Network

ITI Trade Subject

  • ITI Electrician
  • ITI Fitter
  • ITI COPA
  • ITI Welder
  • ITI Mechanic
  • ITI Electronics
  • ITI Wireman
  • ITI Draughtsman Civil & Mech
  • ITI Refrigeration & Air Conditioning
  • ITI Turner
  • ITI Plumber
  • ITI Machinist
  • ITI Cosmetology
  • ITI Sewing
  • ITI Surveyor
By Anand | 12:36 PM IST, Fri March 13, 2026

Loop Control Flow Using While, Do–While, For Loop, Break and Continue Statements in Java

In programming, many tasks require repeating a set of instructions multiple times. For example, printing numbers from 1 to 100, processing records in a database, or reading user input repeatedly. Instead of writing the same code again and again, programming languages provide structures called loops.

A loop allows a program to execute a block of code repeatedly until a specified condition becomes false. Java provides several types of loops that allow programmers to control repetition in different ways.

The most commonly used loop structures in Java are while loop, do–while loop, and for loop. Java also provides loop control statements such as break and continue that modify the behavior of loops.

For students studying the ITI COPA (Computer Operator and Programming Assistant) trade, understanding loops is essential because loops are widely used in almost every Java program.

What is a Loop?

A loop is a control structure that repeatedly executes a block of code while a specified condition remains true.

Loops are useful for performing repetitive tasks efficiently without writing large amounts of code.

For example, printing numbers from 1 to 5:

1
2
3
4
5

Instead of writing five separate print statements, a loop can perform this task easily.

The while Loop

The while loop is used when the number of iterations is not known in advance. The loop continues executing as long as the condition remains true.

Syntax

while(condition) {
    // code to be executed
}

Example

public class WhileExample {

    public static void main(String[] args) {

        int i = 1;

        while(i <= 5) {
            System.out.println(i);
            i++;
        }

    }

}

This program prints numbers from 1 to 5 using a while loop.

The do–while Loop

The do–while loop is similar to the while loop, but it guarantees that the loop body will execute at least once. This is because the condition is checked after the loop body executes.

Syntax

do {
    // code to execute
} while(condition);

Example

public class DoWhileExample {

    public static void main(String[] args) {

        int i = 1;

        do {
            System.out.println(i);
            i++;
        } while(i <= 5);

    }

}

This program prints numbers from 1 to 5 using a do–while loop.

The for Loop

The for loop is commonly used when the number of iterations is known in advance.

The for loop combines initialization, condition checking, and increment/decrement in one statement.

Syntax

for(initialization; condition; update) {
    // code to execute
}

Example

public class ForLoopExample {

    public static void main(String[] args) {

        for(int i = 1; i <= 5; i++) {
            System.out.println(i);
        }

    }

}

This program prints numbers from 1 to 5 using a for loop.

Difference Between While and Do–While Loop

FeatureWhile LoopDo–While Loop
Condition CheckBefore executionAfter execution
ExecutionMay execute zero timesExecutes at least once

The break Statement

The break statement is used to terminate a loop immediately when a specific condition is met.

When the break statement is executed, the program exits the loop and continues with the next statement after the loop.

Example

public class BreakExample {

    public static void main(String[] args) {

        for(int i = 1; i <= 10; i++) {

            if(i == 5) {
                break;
            }

            System.out.println(i);

        }

    }

}

This program stops printing numbers once the value reaches 5.

The continue Statement

The continue statement is used to skip the current iteration of a loop and move to the next iteration.

Example

public class ContinueExample {

    public static void main(String[] args) {

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

            if(i == 3) {
                continue;
            }

            System.out.println(i);

        }

    }

}

In this program, the number 3 is skipped.

Nested Loops

Java also allows loops inside other loops. This is known as nested loops.

Example

public class NestedLoopExample {

    public static void main(String[] args) {

        for(int i = 1; i <= 3; i++) {

            for(int j = 1; j <= 2; j++) {
                System.out.println("i = " + i + ", j = " + j);
            }

        }

    }

}

Nested loops are useful for working with tables, matrices, and complex calculations.

Applications of Loops in Java

Loops are used in many programming tasks such as:

  • Printing sequences of numbers
  • Processing large datasets
  • Menu-driven programs
  • Game development
  • Data validation

Without loops, many programs would require large amounts of repetitive code.

Importance for ITI COPA Students

For students studying the ITI COPA trade, learning loops is essential because loops help automate repetitive tasks in programs.

Understanding loops allows students to write efficient programs that process large amounts of data with minimal code.

Loops also help students understand advanced programming concepts such as arrays, data processing, and algorithm design.

Conclusion

Loop control structures allow Java programs to repeat instructions efficiently. Java provides three main loop types: while loop, do–while loop, and for loop.

Loop control statements such as break and continue allow programmers to modify loop behavior and control program flow.

For ITI COPA students, understanding loops is an important step toward writing efficient Java programs and developing real-world software applications.

Book traversal links for Loop control flow using while – do, do – while loops, for loop, using the break, continue statements

  • ‹ Java Programming features
  • Up
  • Method Overloading ›
  • Printer-friendly version

Article

Types of Files in Computer System
Safety Signs and Symbols Used in Workplace
Safety Rules While Using Computer
Can I start my own business after doing ITI in COPA trade?
Scope in Government Jobs after Doing ITI in COPA

Books

Introduction to Programming in Java
Programming language (Python)
Cloud Computing
Cyber Security
Advanced Excel Concepts
Database Concepts
Communicating in a Connected World
Using Spread Sheet Application
Designing Static Web Pages
Internet Concepts
Configuring and Using Networks
Database Management
Image editing, Creating presentations & Using Open Office
Using Word Processing Software
Familiarization with DOS CLI & Linux Operating Systems.
🖥️ Computer Hardware Basics and Software Installation
🖥️ Computer Components and Windows Operating System
Cyber Security
E Commerce
Smart Accounting
Introduction to VBA, Features and Applications
Introduction to JavaScript 🧠💻
Web Design Concepts
Internet Concepts 🌐
Networking Concepts 🌐
🗄️ Database Management Systems (DBMS)
Power Point Presentations
📊 Spreadsheet Application – Trade Theory for COPA
📝 Word Processing – Trade Theory for COPA
🖥️ Introduction to DOS Command Line Interface & Linux Operating System – Trade Theory for COPA
🖥️ Computer Hardware Basics and Software Installation – Trade Theory for COPA
Introduction to Computers and Windows Operating System

Question Paper

Hindi

COPA 2024 – प्रश्न पत्र सेट 11
COPA 2024 – प्रश्न पत्र सेट 1
COPA 2024 – प्रश्न पत्र सेट 2
COPA 2024 – प्रश्न पत्र सेट 3
COPA 2024 – प्रश्न पत्र सेट 4
COPA 2024 – प्रश्न पत्र सेट 5
COPA 2024 – प्रश्न पत्र सेट 6
COPA 2024 – प्रश्न पत्र सेट 7
COPA 2024 – प्रश्न पत्र सेट 8
COPA 2024 – प्रश्न पत्र सेट 9
COPA 2024 – प्रश्न पत्र सेट 10

English

ITI COPA 2023 Question Paper
ITI COPA 2023 Question Paper – Set 2
ITI COPA 2023 Question Paper – Set 3
ITI COPA 2023 Question Paper – Set 4

Common Subject

  • Engineering Drawing
  • Employability Skills
  • Workshop Calculation Science

Directory

  • Industrial Training Institutes
  • Engineering College
  • Medical College

Knowledge Bank

  • ITI Syllabus
  • Tools

Copyright © 2026 Company Name - All rights reserved

Developed and Designed by Alaa Haddad at Flash Web Center, LLC