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 trialTobias Edwards
14,458 PointsJava Basics Challenge Improvement
The Question:
I have placed several errors in this challenge. To fix them you must remove the // to uncomment them and then correct the error.
Uncomment the first line and fix the error. If you do not see the error, click submit and view the Preview pane to view the compiler error.
For this, the challenge is to find errors and correct them. Although, when I was working my way through each line, I thought I would need:
import java.io.Console;
because the challenge does not state that the package was included.
Maybe add a comment in the question or editor that the package is already imported for clarity?
// Sting firstName = "Gordon";
// string lastName = "Sumner";
// console.printf("Hello %s", firstName)
// band = console.readLine("Which band? ");
2 Answers
andrea
2,215 PointsI think since those packages haven't been taught, it would not make sense for them to ask us to put that in ourselves.
I always just assume that they will only ask us what we have learned so far in the exercises and quizzes since some of the people taking these courses do not have any experience in coding like myself. Although, I do see your point that it would be clearer if it was stated.
I hope that helps in the future.
md12
7,678 Pointsif you look carefully there were mistakes in sting instead of String, as well on second line s is not capital etc...here how I had fixed mine:
String firstName = ("Gordon");
String lastName = ("Sumner");
console.printf("Hello %s", firstName);
4.String band = console.readLine("Which band? ");