Does anyone know how to solve this question? Thanks

Use the `&&`

operator and valid Boolean expressions on each side of `&&`

.

`Replace this line with your code.`

Does anyone know how to solve this question? Thanks

Use the `&&`

operator and valid Boolean expressions on each side of `&&`

.

`Replace this line with your code.`

`&&`

(Logical and) is a binary operator `AND`

, It means that It takes two data (Boolean values) to operate on.

This is how it works.

```
true && true -- > true
true && false --> false
false && false --> false
false && true --> false
```

so It evaluates `true`

if both expressions(left and right sides evaluates to true) otherwise it gives us `false`

.

AS we've already know how to use comparison operators ,use them and make boolean expressions then use `&&`

.

one simple boolean expression should look like this..

int x = 3;

int y = 4;

`x > y`

will evaluate to a boolean value.

I can't ( It's against rules of CC) ,also It won't help you in long run!

Tho I can give you further hint.

look, this is what you have to make..

`booleanExpression && booleanExpression`

Now all you have to do is to create two boolean expressions or you can directly use boolean values (`true/false`

)

I think it's right as follow, thanks a lot!!!

```
boolean p=true;
boolean j=false;
System.out.println(p && j);
```

Yeah thats how we use `&&`

with boolean expressions/values.

While you go with CC's exercises, do read some side tutorials on Java.

lots of cool tutorials are available on the internet.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.