# Question 11- Conditionals and Conditions Flow

How do you solve the following question?
Use the precedence rules to help you evaluate the Boolean expression in the single line comment above the tricky variable.
Then, set the boolean variable tricky equal to the result (either true or false).

public class GeneralizationsB {
public static void main(String args) {

``````//3 >= 3 && !(true || true) );
boolean tricky= false;

if(2015 < 2016) {

System.out.println("Stuck in the past...");

}else {

}``````
2 Likes

This is correct - this expression `3 &gt;= 3 && !(true || true) );` is really false.

2 Likes

thank you!
many thanks

1 Like

WHAAAAAAT? im soooooo clueless

1 Like

what did you do to get it right?

1 Like

3 >= 3 - this is true, because 3 is equal to 3
!(true || true) - this is false, because the expression in the brackets is true and there is “!” before the brackets

When we use the && operator to 3 >= 3 and !(true || true) we have true && false which is false.

Then the instructions say to set this value to tricky. That’s all : )

3 Likes

i knw beginning to be annoying bt can u type what u wrote to get the right results?
this is now getting to that i dont get what they are asking me to do

1 Like

Without giving you code, let’s see if we can get you understanding this. The goal here is to learn, so don’t give up! Let’s stretch your brain a bit.

You need to use non-code related logic skills to evaluate for yourself the answer to `3 >= 3 && !(true || true));`

In plain English, the above snippet means:

``````"Three IS GREATER THAN OR EQUAL TO three AND THE INVERSE OF THE GROUP true OR true."
``````

Using logic, we can see the sentence as a whole is false.

Breaking it up:

1. Three IS GREATER THAN OR EQUAL TO three: this is true!
2. THE INVERSE OF THE GROUP true OR true: this is false!

When comparing two things and one of the two is false, then the entire thing can never be true.

Do you see or can you infer as to why that is?

The instructions of this exercise ask you to simply evaluate in your head whether the expression as a whole is true or false, which, as explain, it is clearly false. Therefore, either set `tricky` to the expression itself or to the primitive boolean literal `false`.

Do you understand? 4 Likes

public class GeneralizationsB {
public static void main(String args) {

``````// ( 3 >= 3 && !(true || true) )
boolean tricky (3 >= 3 && (true || true))

if(2015 < 2016) {
``````

… what did i do wrong? its not running

1 Like

You need an `=` assignment operator.

`boolean tricky **=** (3 >= 3 && (true || true))`

2 Likes

wooooooooow i was way outer space,

1 Like

Honestly, I’m super confused with this whole thing. I don’t really know what it’s asking me to do 1 Like
``````// first you must evaluate the expression on the next line ( it will be true or false )
// ( 3 >= 3 && !(true || true) )

// then put the answer after the = sign on this next line:
boolean tricky =
``````
1 Like

OK… This makes sense. It was basically saying type two statements that may or may not be true! like true==false or 3>=2 or whatever. Alright I got it.

1 Like

great yaar you solved my problem

1 Like

public class GeneralizationsB {
public static void main(String args) {

``````(3 >= 3 && !(true || true));
boolean tricky = false;

if(!(2015 < 2016)) {

System.out.println("Stuck in the past...");

}else {

}
``````

Let`s move further on this exercises, although I`ve done first part of exercise like you said, I get this message
“GeneralizationsB.java:4: error: not a statement
(3 >= 3 && !(true || true));
^
1 error”

In second part of exercise I should change something in IF statement to escape true answer and print false (else statement), right?
So I try several things…first I wrote
if(2015 > 2016)…then
if(2015 < 2014)…then
if(!(2015 < 2016))…
and everytime I can not pass

What is wrong with my code?

1 Like

in the same exercise, part three, we should put number 5 instead of th 9, right?

1 Like

hey just figured it out put the // back in to the beginning.
just undo the first half of step one

1 Like

Is there any other way to put another equation in to solve it, i’m not seeing where you all got the equation that you are using and the actual digits that you are using to solve this exercise. I would like to solve it with a different equation if possible. If that is not possible, where did you get this equation from? I don’t see this equation set up on the exercise. Please respond.

1 Like

2 posts were split to a new topic: How do you solve problem 11/12?