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 trialTed Clayton
Courses Plus Student 206 PointsClass names, 'index.html', are only accepted if annotation processing is explicitly requested?
I'm a newbee and so I copied the code verbatim and just added my name. When I tried to compile it the error message above came up. Here is my code. Any advise would be appreciated.
public class index {
public static void main(String[] args) { Console console = System.console(); // Welcome to the index progam! Your code goes below here String first console.printf("Hello my name is Ted"); console.printf("Ted is learning how to write Java");
2 Answers
Joshua O'Brian
20,747 PointsClass names usually and for best practice start with and uppercase. If you are doing this on a local environment you might want to look at using System.out.printf() or System.out.println();
if you are talking about the challenge that is after the video you do not need to make a class name that is already defined for you in the background. So your code should look like this:
//declaring String
String firstName = "bob";
//Proper use of printf %s is a placeholder that allows you to inject a value
console.printf("%s can code in Java!",firstName);
Ted Clayton
Courses Plus Student 206 PointsJoshua, Thank you for the reply as your code worked for the exercise right after the video. When do I use Workspaces if I'm new to this?
Joshua O'Brian
20,747 PointsYou would use workspaces whenever you want or as you are working through the courses. If you make a new java class in there you would then have to declare it like you did. The class can be named anything but for java to run your program you must have the main method with the class you are running.