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 trialMichael Stedman
Full Stack JavaScript Techdegree Student 13,838 PointsClass, interface, or enum error???
console.printf("Hello, my name is Craig\n");
console.printf("Craig is learning how to write Java\n");
The very first time that I compiled it (without the break sequences), everything came up as it should (not being broken into two lines). However, once I started using the break sequences, I constantly get some sort off error in the console after all the "Picked up Java_Tool_Options" mumbo jumbo:
Introductions.java:1: error: class, interface, or enum expected
javaimport java.io.Console;
^
1 error
I have tried just about everything: trying the opposite slash, the percent sign that other answered questions have recommended, putting a space after the words that I am wanting to add the break to... Everything. I also made sure to save after each thing that I changed, but still get the same result. Now, when I take out the break sequences completely, and go back to the original two strings, I continue to get this error without fail.
Just to add... I just basically tried to start it all over. I deleted both of the strings completely, and then saved it. Just to see what it would do, I ran the compiler and it came up printing the one long sentence that we are trying to break up with the sequence breaks, even though there are no strings at all in the saved code.
1 Answer
Shane Robinson
7,324 PointsThere is no issue with the print statements you have. The issue lies somewhere in your imports, based on the error you are getting. Could you post all of your code? It looks like you accidentally typed:
javaimport java.io.Console;
instead of
import java.io.Console;
Michael Stedman
Full Stack JavaScript Techdegree Student 13,838 PointsMichael Stedman
Full Stack JavaScript Techdegree Student 13,838 PointsThanks for the quick answer Shane. Below is the code as it first opens when I launch the workspace, and then click on the Introductions.java tab:
Update: That that got it to work, Shane. I do not know how the workspace got that part added in there as I didn't type it, but now that it is gone, everything seems to be working fine.