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 Getting Started with Java Strings, Variables, and Formatting

Mahmoud Ibrahim
Mahmoud Ibrahim
39 Points

string and variable

Second day in Java, and I’m stuck on the second exercise.

Define a String variable named firstName that stores your nam

Name.java
// I have setup a java.io.Console object for you named console

import java.io.Console;
public class introductions {

  public static void main (String[] args) {
    Console console = System.console();

    //practics 
    console.printf("hell, my name is Ali");
  }
}

1 Answer

Travis Alstrand
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Travis Alstrand
Treehouse Project Reviewer

Hey there Mahmoud Ibrahim ! šŸ‘‹

There is a lot of code here that is likely throwing off the backend that runs these code challenge tests. The comment up top states that a java.io.Console object named console is already set up for you, so you don't need to import / set that up all over again.

You're also not expected to know how to / have to set up all the class structure and main() method either. For the first step in this challenge, you only need to do exactly what the task requests. For example:

// I have setup a java.io.Console object for you named console
String firstName = "Travis";

Just so you know going forward, these code challenges are extremely specific. Any extra code it's not asking for will likely throw errors. You can click on the "Preview" tab at the top to see the errors if you do encounter them though. Always feel free to post here as well though, we're here to help! 😃