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

got stuck in the execution part

import java.io.Console;

public class TreeStory {

public static void main(String[] args) {
    Console console = System.console();
    /*  Some terms:
        noun - Person, place or thing
        verb - An action
        adjective - A description used to modify or describe a noun
        Enter your amazing code here!
    */
  int age = 12;
  if(age < 13){
    console.printf("Oops sorry! You are underage to use this program ");
    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 adverb: "); String verb = console.readLine("Enter a verb ending with -ing: "); console.printf("Treehouse story:\n-----------------------\n"); console.printf("%s is very %s %s. ", name, adjective, noun); console.printf("They are always %s at %s. ", adverb, verb); }

} this is my code while running this i am getting an error message : error: Class names, 'java,TreeStory', are only accepted if annotation processing is explicitly requested can somebody help me with this?? Thanks

2 Answers

Tonnie Fanadez
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Tonnie Fanadez
UX Design Techdegree Graduate 22,796 Points

Shashnaj your error was caused by one of the following

  1. Not using the .java extension for your TreeStory java file
  2. Improper capitalization of the .java extension e.g. writing Java instead of java
  3. typo in the .java extension when compiling e.g. typing jva instead of java

most probably in your case you forgot to include the .java suffix after <javac TreeStory>

Use these steps and it will help solve:

Press Enter after each line.

1 - Clear 2 - javac TreeStory.java 3 - java TreeStory

Your code is correct, You must have caused problem during compiling and running the program.