Conditionals and Control Flow

Conditionals and control flow in Java programs.

Start[missing "en.views.course_landing_page.learn-java.course_illustration" translation]
Conditionals and Control Flow
Lesson 1 of 1
  1. 1

    So far, we've explored primitive data types and Java syntax. As we've seen, Java programs follow the instructions we provide them, such as printing values to the console. We can also write Java p...

  2. 2

    Let's look at a set of operators that let us use control flow in our programs. These operators are called Boolean operators. There are three Boolean operators that we will explore. Let's start wit...

  3. 3

    Great! The second Boolean operator that we will explore is called or. 1. The or operator is represented in Java by [...] . 2. It returns a Boolean value of [...] when at least one expressio...

  4. 4

    Fantastic! The final Boolean operator we will explore is called not. 1. The not operator is represented in Java by [...] . 2. It will return the opposite of the expression immediately after i...

  5. 5

    The three Boolean operators [...] , [...] , and [...] can also be used together and used multiple times to form larger Boolean expressions. However, just like numerical operators, Boolean oper...

  6. 6

    Let's get familiar with how relational, equality, and Boolean operators can be used to control the flow of our code. We'll start by exploring the if statement. 1. In Java, the keyword if is t...

  7. 7

    Sometimes we execute one block of code when the Boolean expression after the [...] keyword is [...] . Other times we may want to execute a different block of code when the Boolean expression is ...

  8. 8

    Good work! In some cases, we need to execute a separate block of code depending on different Boolean expressions. For that case, we can use the [...] / [...] / [...] statement in Java. 1. If the...

  9. 9

    [...] / [...] statements can become lengthy even when you simply want to return a value depending on a Boolean expression. Fortunately, Java provides a shortcut that allows you to write [...] / ...

  10. 10

    The conditional statements that we have covered so far require Boolean expressions to determine which code block to run. Java also provides a way to execute code blocks based on whether a block is ...

  11. 11

    Great work! Control flow allows Java programs to execute code blocks depending on Boolean expressions. What did we learn about control flow so far? - Boolean Operators: [...] , [...] , and [....

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo

Conditionals and Control Flow

Start[missing "en.views.course_landing_page.learn-java.course_illustration" translation]