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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Raymond Pride](https://secure.gravatar.com/avatar/3d659eb81e895f9dd02f0de151776f78?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Raymond Pride
Courses Plus Student 4,938 PointsI'm not sure why but my code will not read. Can anyone help?
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!
*/
//__Name__ is a __adjective__ __noun__. They are always__adverb__ __verb__.//
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("Your TreeStory:\n----------\n");
console.printf(%s is a %s %s. ", name, adjective, noun);
console printf(They are always %s %s.\n", adverb, verb);
}
}
this is the result
TreeStory.java:6: error: ';' expected
Console console System.console();
^
1 error
treehouse:~/workspace$
Also all of the equal signs in the strings above are red on my screen not green
3 Answers
![Jacob Cordeiro](https://secure.gravatar.com/avatar/93bffa01cc36cbb5c36023285eb18cb2?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Jacob Cordeiro
2,796 PointsIn my workspace this code ran perfect.
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 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("Your TreeStory: \n---------------------\n");
console.printf("%s is a %s %s.", name, adjective, noun);
console.printf("They are always %s %s.\n", adverb, verb);
}
}
![Daniel Hartin](https://secure.gravatar.com/avatar/54ac28b0a246c0ccd3618e46699a85b4?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Daniel Hartin
18,106 PointsHi Raymond
It looks like a simple typo, shame the compiler has given you a very cryptic error message (it does this sometimes). It looks to me like you're simply missing an equals sign on the first line in the main method. The code below is corrected.
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!
*/
//__Name__ is a __adjective__ __noun__. They are always__adverb__ __verb__.//
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("Your TreeStory:\n----------\n");
console.printf("%s is a %s %s. ", name, adjective, noun);
console.printf("They are always %s %s.\n", adverb, verb);
}
Hope this helps
Daniel
![Raymond Pride](https://secure.gravatar.com/avatar/3d659eb81e895f9dd02f0de151776f78?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Raymond Pride
Courses Plus Student 4,938 PointsI copied your answer into the worksheet but still the same result
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!
*/ //Name is a adjective noun. They are alwaysadverb verb.// 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("Your TreeStory:\n----------\n"); console.printf(%s is a %s %s. ", name, adjective, noun); console printf(They are always %s %s.\n", adverb, verb); }
this is the result again
TreeStory.java:6: error: ';' expected Console console System.console(); ^ 1 error
![Daniel Hartin](https://secure.gravatar.com/avatar/54ac28b0a246c0ccd3618e46699a85b4?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Daniel Hartin
18,106 PointsHi Raymond
Sorry, I think I missed something... the last 2 line were muddled with the speech marks. I have compiled and tested the below in workspaces and all is well :)
import java.io.Console;
public class Introductions {
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!
*/
//__Name__ is a __adjective__ __noun__. They are always__adverb__ __verb__.//
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("Your TreeStory:\n----------\n");
console.printf("%s is a %s %s. ", name, adjective, noun);
console.printf("They are always %s %s.\n", adverb, verb);
}
}
![Raymond Pride](https://secure.gravatar.com/avatar/3d659eb81e895f9dd02f0de151776f78?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Raymond Pride
Courses Plus Student 4,938 Pointsimport java.io.Console;
public class Introductions {
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!
*/
//Name is a adjective noun. They are always adverb verb.
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("Your TreeStory:\n----------\n");
console.printf("%s is a %s %s. ", name, adjective, noun);
console.printf("They are always %s %s.\n", adverb, verb);
}
}
TreeStory.java:6: error: ';' expected
Console console System.console();
^
1 error
Still the same error. Maybe something is wrong with my workspace client?
![Daniel Hartin](https://secure.gravatar.com/avatar/54ac28b0a246c0ccd3618e46699a85b4?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Daniel Hartin
18,106 PointsAlright Raymond
Just to make sure, when you paste the corrected code I've posted into workspaces are you saving the changes and then recompiling the code using
clear && javac Introductions.java && java Introductions
in the console window of workspaces? it's just I have compiled and run that code perfectly and I want to rule out some other possibilities first.
![Craig Drummond](https://uploads.teamtreehouse.com/production/profile-photos/6083662/micro_Charlie.jpg)
Craig Drummond
933 PointsIn your first printf line, your forgot the first quotation mark, just before the %s: console.printf(%s is a %s %s. ", name, adjective, noun); Should read: console.printf("%s is a %s %s. ", name, adjective, noun);
For the second printf statement, you are missing a period between console and printf: console printf(They are always %s %s.\n", adverb, verb); Should read: console.printf(They are always %s %s.\n", adverb, verb);
This could also be why you're generating these errors.