From the course: Learning Java 11

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Operators in Java

Operators in Java - Java Tutorial

From the course: Learning Java 11

Start my 1-month free trial

Operators in Java

- [Instructor] Thinking back to the decision block in our control flow, we have three main components. We have a condition, the code that gets run if the condition is true, and the code that gets run if the condition is false. To simplify our condition, we can just write out our condition with the less than sign instead of writing it out in English. This is closer to what it will look like in our code. Ultimately, the value of inputting them or the number that the user inputs will determine which print statement is run, which is exactly what we want. We call the less than sign a relational operator. Its inputs are inputtedNum and five. And the relational operator, less than, states a comparison between these two inputs. The result of this overall comparison will evaluate to either true or false. Since the inputtedNum less than five comparison evaluates to a Boolean, we call it a Boolean expression. And a Boolean expression can be used as a condition for our decision blocks. Of course,…

Contents