JAVA · ОСНОВЫ · LESSON 07

Yes or no.

Type boolean · about 14 minutes

Learning with progressRead the summary for free. To save the work, log in to the account.
STEP 1

The test has an answer.

boolean only stores true or false: yes or no. Comparison of numbers also gives this answer.

boolean ready = true;

✦ ready stores the «да» response.

STEP 2

Compare the two numbers

Знак > спрашивает, больше ли число слева. Сохрани ответ в boolean и выведи его.

boolean tall = 8 > 5;
System.out.println(tall);
Verification
8 > 5questionbooleankeepertrueyes

✦ This is true.

IN-CLASS PRACTICE

Type the code yourself

Type an example manually. Check the signs and brackets.

public class Main {
    public static void main(String[] args) {
        boolean bigger = 7 > 3;
        System.out.println(bigger);
    }
}
Open the editor for class work
HOMEWORK

Solve it yourself

Создай boolean enough как проверку 4 > 6. Выведи enough.

The answer is hidden. Use similar examples from the lesson notes.

Opening up your homework