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

matt hackney
matt hackney
380 Points

Help with Treestory.java

i need help! cant figure out the errors : Identifier needed and class, interface or enum needed

here is the code

TreeStory.java
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);
matt hackney
matt hackney
380 Points

(the structure changed when i pasted the code to the forum)

I edited your post matt hackney to add syntax highlighting and preserve whitespace. :)

4 Answers

I 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
Michael Hess
24,512 Points

String 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: ");

Yep, that too.

Craig Dennis
STAFF
Craig Dennis
Treehouse Teacher

I think you accidentally removed the main method....

TreeStory.java
import java.io.Console;
public class TreeStory {
    //Missing this
    public static void main(String[] args) {
       //your code here
       //...
    // Need to close
    }
// Need to close
}