# Infinite Loop

*noun*

say it: **“IN-fuh-nit LOOP”** **/ˈɪnfənɪt lup/**

A loop that never stops, because its stopping condition never becomes false.

## What is **Infinite Loop** in Java?

**Infinite Loop** — A loop whose stopping condition never becomes false.

```java
class NumberFinder {
    int firstOddNumber(int[] numbers) {
        for (int number : numbers) {
            if (number % 2 == 0) {
                continue;
            }

            return number;
        }

        return -1;
    }
}
```

## In a sentence

- “I forgot to add 1 to count, so I wrote an **infinite loop** that printed 0 forever.”

Level: Apprentice · [More Java terms at this level](https://www.ask-codey.com/glossary?category=java&level=2)

Updated: October 26, 2026

## In other subjects

- [Infinite Loop in C#](https://www.ask-codey.com/glossary/infinite-loop-c-sharp)
- [Infinite Loop in JavaScript](https://www.ask-codey.com/glossary/infinite-loop-javascript)
- [Infinite Loop in PowerShell](https://www.ask-codey.com/glossary/infinite-loop-powershell)
- [Infinite Loop in Python](https://www.ask-codey.com/glossary/infinite-loop)

Source: https://www.ask-codey.com/glossary/infinite-loop-java
