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 Basics Perfecting the Prototype Reviewing Our Feedback

have hard coded age restriction but when I run program is does not restrict it why?

//Name is a adjective noun. They are always adverb verb. int age = 12; if (age < 13) { //Insert exit code console.printf ("Sorry u must be at least 12 to use this program.\n") System.Exit(0);

}

String name = console.readLine("Enter a name: "); String adjective = console.ReadLine("Enter an adjective: "); String noun = console.readLine ("Enter a noun: "); String adverb = console.readLine (" Enter an adjective String verb = console.readLine ("Enter a verb ending with in -ing: "); console.printf ("Your TreeStory:---------\n"); console.printf ("%s is a %s %s. ", name, adjective, noun); console.printf ("hey are always %s %s.\n", adverb, verb);

when I run command clear && Java TreeStory.java && Java TreeStory it says javac command not found

2 Answers

Yanuar Prakoso
Yanuar Prakoso
15,196 Points

Hi Troy

I really wish and recommend that you use the forum's Markdown Cheatsheet link and follow its' instruction when posting your question so that others will understand your situation much clearer.

//Name is a adjective noun. They are always adverb verb. int age = 12; if (age < 13) { //Insert exit code console.printf ("Sorry u must be at least 12 to use this program.\n") System.Exit(0);

The source of your problem most possible is in here but I cannot say for sure because as you can see you wrote it or paste it in line. If this is how you actually wrote your code it is possible that one of the code is treated as comments since you use // .

Please click the Markdown Cheatsheet below your post text box before you post the question. Better yet please re-post the question after you read it. Thank you and happy coding.

You're missing a semicolon after your "Sorry u must be 13" in the if statement.