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 trialStephen Tam
214 PointsJava Instroductions TreeStory
Hello I'm getting an error on this code? Can you please help me find the mistake ? Thanks for your 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 __.
int age = 12;
if (age < 13) {
// Insert exit code
console.prinft("Sorry you must be at least 13 to use this program.\n");
System.exit(0);
}
2 Answers
andren
28,558 PointsThe error message is telling you that it cannot find a console method named prinft
that takes a string. This is because you have a typo in the name. The method is actually called printf
(you switched the t and f around). If you fix that typo then that should fix the error.
Stephen Tam
214 PointsOh sorry guys for asking such a small mistake. Thank you!
Fahad Mutair
10,359 Pointsit should be printf not prinft
Stephen Tam
214 PointsOh sorry guys for asking such a small mistake. Thank you!
Stephen Tam
214 PointsStephen Tam
214 PointsThis is the error Picked up _JAVA_OPTIONS: -Xmx128m
TreeStory.java:17: error: cannot find symbol
console.prinft("Sorry you must be at least 13 to use this progra m.\n");
^
symbol: method prinft(String)
location: variable console of type Console
1 error
??
Thank you!