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 Using your New Tools Coding the Prototype

John Vieyra
John Vieyra
2,826 Points

why does this not work?

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!
    */
}
String noun = console.readLine("Write a noun: ");
String verb = console.readLine("Write a verb: ");
String adjective = console.readLine("Write an adjective");

console.printf("%s is the %s state in the world, it %s. ",noun,adjective,verb);

}

John Vieyra
John Vieyra
2,826 Points

Thanks for responding michaelcodes. I did that and all it said was I picked up java_tool_options.:-Xmx128m

michaelcodes
michaelcodes
5,604 Points

That is good! that means that it compiled fine and can now be run :)

That message that you see is just because of certain settings that treehouse has applied to there workspaces compiler. It is totally normal.

michaelcodes
michaelcodes
5,604 Points

If you want a more in-depth explanation of this there was a discussion about the Xmx128m coming up about a week ago:

https://teamtreehouse.com/community/how-to-remove-picked-up-javatooloptions-xmx128m

2 Answers

michaelcodes
michaelcodes
5,604 Points

Hi there, it seems there is a misplaced ending curly brace } in the code, I inserted comments showing the old location and the new location it was moved it too.

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!
    */
//<---There was an ending curly brace placed here (ended main)
String noun = console.readLine("Write a noun: ");
String verb = console.readLine("Write a verb: ");
String adjective = console.readLine("Write an adjective");

console.printf("%s is the %s state in the world, it %s. ",noun,adjective,verb);
   }//<---Moved to this location to encompass the code
}

Take care and happy coding!