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

Alin Stanescu
Alin Stanescu
15,793 Points

Hy...does anyone know what the correct answer is for this question: http://teamtreehouse.com/library/java-objects/delive

No proper explanations...Confusing!!

Craig Dennis
Craig Dennis
Treehouse Teacher

What is the problem you are having? If you use Ask Question from the code challenge it will share your code, and then you can clarify what you aren't understanding.

Ken Alger
Ken Alger
Treehouse Teacher

Alin;

I would have to concur with Mr. Dennis. If you can provide some additional information about your specific question, I am sure someone will be able to assist.

Ken

Alin Stanescu
Alin Stanescu
15,793 Points

Fill in the blank below.

Okay, so we have a code version of a carnival based Dunk Tank. Please fill in the blanks with proper code for the while loop.

while (remainingTries __________ 0 _________ _____________ dunkTank.isDunked()) { throwBall(); }

Any Idea what to put in the 3 empty spots to make the loop work?

2 Answers

while (remainingTries .... >   ....  0 ...    &&     ...   !    ...      dunkTank.isDunked()) { throwBall(); }

Try this I am sure it works. The aim of the code is to stop throwing the ball when the remaining tries is zero and when the dunk tank is dunked hence the '!' is used. Hope this helps. Please tell me if it helps.

JAVIER GARCIA
JAVIER GARCIA
9,176 Points

Why != 0 && ! is a wrong answer?