Java Java Basics Perfecting the Prototype Reviewing Our Feedback

got stuck in the execution part


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 ");
  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
.a{fill-rule:evenodd;}techdegree seal-36
Tonnie Fanadez
UX Design Techdegree Graduate 22,782 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 3 - java TreeStory

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