Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Java Objects (Retired) Meet Objects Refresher

Lauren Lolo
Lauren Lolo
352 Points

How do you ensure that both booleans are true?

I don't understand how to make both booleans true.

2 Answers

Hey Lauren,

The question is referring to the logical operators of Java (And/Or). In this particular case, you'll want to use the logical And operator, which is written as '&&'.

boolean shouldContinue = isRefreshed && isReadyToGetStarted;

But try to wrap your head around why this works instead of using the logical Or operator. I'd suggest going over this section of the course again before proceeding.



Grigorij Schleifer
Grigorij Schleifer
10,365 Points

& <-- verifies both operands && <-- stops evaluating if the first operand evaluates to false since the result will be false

Look here: