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 trialAbdullah Nazeer
239 Pointswhat's wrong with my code?
import java.io.Console;
public class TreeStory {
public static void main(String[] args) {
Console console = System.console();
String name= console.readLine("What's Your name ");
String race= console.readLine("Which race do you belong to ");
String birthDay= console.readLine(" Which month were you born on");
String ageAsString= console.readLine(" How old are you " );
int age=Integer.parseInt(ageAsString);
String noun= console.readLine("Please type in a noun ");
if (noun.equalsIgnoreCase("dork")){
console.printf("This language is not allowed, Exiting site /n");
System.exit(0);}
if(age<13)
{console.printf("Sorry you can't use this site\n");
System.exit(0);}
}
}
1 Answer
Ted Dunn
43,783 PointsIt looks like you have used a forward slash (/) in your attempted escape character for a new line at the end of the sentence, "This language is not allowed, Exiting site /n".
The character should be: \n.