Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java Java Basics Perfecting the Prototype Conditional ints

Stuart Jessiman
Stuart Jessiman
465 Points

Yet more Workspace issues. I have checked code multiple times and all is fine. Yet it tells me a ; is missing. Bla......

The test is giving me errors. When first given the 'bummer' message I assume it is me that has caused the issue. But I have checked the code (it isn't lengthy) and there is no problem. Especially it pointed to a line and said the System.exit(0); needed a ';'. It's there and in the right place. As a UX Designer, I so want to make some changes. I get the code logic here, I just find it difficult to achieve what I want to achieve and navigate to points on the course I may wish to revisit - say if I"ve been away for a while.

The tutor is excellent, but the rest is a bit of a bother.

Conditional.java
int numberOfPeople = 4;

if(numberOfPeople<4 )
{
  console.printf("You are not old enought");
  System.exit(0);
} 

if (numberOfPeople >4)
{
  console.printf("Your table is ready");

}

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,624 Points

Hey Stuart,

The code itself is fine, but remember the instructions for Task One?

Create an integer that stores "number of people" ( Use camel case). Set the value to 3.

You changed the value of that variable to 4... so now the Code Checker will return the Bummer!

Also, for some reason, the challenge is passing Task Two and Task Three even though what you coded is not what the tasks are asking for, which is very strange. (Tagging Craig Dennis to have a look).

There should only be one if statement (asked for in Task two) and the exit method asked for in Task Three.

Normally if you add anything that was not asked for specifically by the instructions, the task will fail, but not in this case. Anyway, for this challenge, just change the value back to 3 and, oddly, it will pass.

Just for future reference, however, Challenges are very picky, so be careful with what you code. Your code above is syntactically correct, just not in the instructions. For this challenge, the completed code (according to the instructions) would be:

int numberOfPeople = 3;

if (numberOfPeople < 4) {
  console.printf("Your table is ready");
  System.exit(0);
}

Keep Coding! :) :dizzy: