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 trialmatt hackney
380 PointsHelp with Treestory.java
i need help! cant figure out the errors : Identifier needed and class, interface or enum needed
here is the code
import java.io.Console;
public class TreeStory {
int age = 12;
if (age < 13) {
//insert exit code
Console.printf ("sorry, you must be at least 13 to use this.\n")
system.exit(0);
}
String name = console.readLine("enter a name: ");
String adjective = console.readLine("enter an adjective: ");
String noun = console.readLines("enter a noun: ");
String adverb = console.readLines("enter an adjective: ");
String verb = console.readLine("enter a verb ending in -ing: ";
console.printf("Your TreeStory:\n------------------------\n");
console.printf("%s is a %s %s. ", name adjective, noun);
console.printf ("they are always %s %s.\n", adverb, verb);
Geoff Parsons
11,679 PointsI edited your post matt hackney to add syntax highlighting and preserve whitespace. :)
4 Answers
Dan Donche
6,214 PointsI think you might be missing a semicolon after your console.printf line:
Console.printf ("sorry, you must be at least 13 to use this.\n")
Michael Hess
24,512 PointsString verb = console.readLine("enter a verb ending in -ing: ";
It looks like you're missing a right parenthesis bracket, too.
Try: String verb = console.readLine("enter a verb ending in -ing: ");
Dan Donche
6,214 PointsYep, that too.
Craig Dennis
Treehouse TeacherI think you accidentally removed the main method....
import java.io.Console;
public class TreeStory {
//Missing this
public static void main(String[] args) {
//your code here
//...
// Need to close
}
// Need to close
}
matt hackney
380 Pointsthanks!
matt hackney
380 Pointsmatt hackney
380 Points(the structure changed when i pasted the code to the forum)