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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Harry Jones](https://uploads.teamtreehouse.com/production/profile-photos/3050472/micro_14_copy.jpg)
Harry Jones
2,964 PointsConfused... Overwhelmed.
So the challenge tells me: "Move the prompting code into a do while loop. Wrap the code into a do while code block and check in the while condition to see if who is "banana" so that the loop continues"
While I understand the concepts/application of a do/while loop, the prompt itself is confusing me, I'm not sure where to start.
Thanks in advance, Harry.
/* So the age old knock knock joke goes like this:
Person A: Knock Knock.
Person B: Who's there?
Person A: Banana
Person B: Banana who?
...as long as Person A has answered Banana the above repeats endlessly
...assuming the person answers Orange we'd see
Person B: Orange who?
...and then the punchline.
Person A: Orange you glad I didn't say Banana again?
(It's a really bad joke that makes it sound like "Aren't you glad I didn't say Banana again?")
Let's just assume the only two words passed in from the console from Person B are either banana or orange.
*/
// ====BEGIN PROMPTING CODE====
// Person A asks:
console.printf("Knock Knock.\n");
// Person B asks and Person A's response is stored in the String who:
String who = console.readLine("Who's there? ");
// Person B responds:
console.printf("%s who?\n", who);
// ==== END PROMPTING CODE ====
![Harry Jones](https://uploads.teamtreehouse.com/production/profile-photos/3050472/micro_14_copy.jpg)
Harry Jones
2,964 PointsJonathan Grieve - Thanks a ton! I'm actually on vacation right now, so that shouldn't be a problem. :) I'll keep your advice in mind for the future.
1 Answer
![John Breslin](https://uploads.teamtreehouse.com/production/profile-photos/357202/micro_Coming2.jpg)
John Breslin
16,963 PointsAfter where the comment reads "Begin prompting code", put do{
It will say "knock, knock", "who's there" prompt, use the prompt to say "(prompt) who." Then it needs to repeat. Before "end prompting code", put your }while(who=="banana")
![Harry Jones](https://uploads.teamtreehouse.com/production/profile-photos/3050472/micro_14_copy.jpg)
Harry Jones
2,964 PointsOk, that makes sense, thanks!
![John Breslin](https://uploads.teamtreehouse.com/production/profile-photos/357202/micro_Coming2.jpg)
John Breslin
16,963 PointsNo problem
Jonathan Grieve
Treehouse Moderator 91,253 PointsJonathan Grieve
Treehouse Moderator 91,253 PointsHi Harry.
I'm afraid I don't know anything about Java so I don't have anything to answer your query. But I'm just taken by the fact you've put 2 emotions in your title to describe how the problem is making you feel.
I've been there! Having to tackle a new programming language to pass an assessment and feeling that you're not going to make it, that you feel inadequate because of it and that you're probably better off not bothering. Let me stress at this point I'm not suggesting that is right and that is the right course of action for you and me.
All I'm saying is that when this happens, take a breather. Try not to think about code for a little while. Tune your brain out of all things code.
You've done the right thing seeking help in this forum. :) Hopefully after you've had a chance to unwind someone will come up with the answer and it will switch on the lightbulb in your brain that says... "yea there's the answer" and you can kick on from there.
I just wanted to offer a bit of encouragement and hope it will help. :)
Jonathan.