I need some help


#1

Hey guys I am fairly new to java. so I was just wondering if someone can break down what this means for me
!( 1 < 8 && (5 > 2 || 3 < 5)); thanks


#2

@iamgoingtolearnc this is basically a long boolean expression utilizing the boolean operators.

Remember that:

  • && is the AND operator whereby both is true.
  • || is the OR operator whereby either one is true.
  • ! is the NOT operator whereby is results in the opposite.

So !( 1 < 8 && (5 > 2 || 3 < 5)) we will tackle the inner brackets first:

(5 > 2 || 3 < 5) that equals (true || true) thus being true.

Doing the next step of 1 < 8 will also give us true.

We are now left with: !( true && true) = !(true) = false, because of the NOT operator.

Hope this helps visualize it better.