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 Objects Creating the MVP Storing Guesses

Michel Bourgeois
Michel Bourgeois
731 Points

Eerror on jshell when i type jshell> /open Game.java

i m on Hangman and i have my code exactly as it is written. when i want to use jshell to open Game.java that is what i get!!! i tried without private in front of my instances variables but did not work!!!! any ideas! Thanks

jshell> /open Game.java
| Error:
| '{' expected
| class Game;
| ^
| Error:
| reached end of file while parsing
| class Game;
| ^
| Error:
| illegal start of expression
| private String answer;
| ^

4 Answers

Michel Bourgeois- Zachary is referring to using the button (I forget the name of it but it looks like this: ` ) that is just above the TAB button on the keyboard. It looks like a smaller and backwards apostrophe, and the button also has a ~ as the secondary symbol that would show up if you depressed SHIFT while hitting the button.

When you are copying/pasting (or just typing) code into these message forum/boards, you insert three of those symbols at the start of whatever you want to appear looking like code, as well as three at the very end. Doing this will change the font and appearance of the text you typed as code, so people can see that it is specifically looking like code. Just easier to read and differentiate between "code" and the text of your questions/comments in the forum. Make sure not to put any spaces in between the three symbols

This is what it looks like when you use three of those symbols at the very beginning, and at the very end of whateer code you trying to show people..

And this is what it looks like without those... Pretty much just regular text.

Zachary Kaufman
Zachary Kaufman
1,463 Points

Can you show us your code? You can either send us a snapshot of your workspace (Little icon in the upper right hand corner when you have your code open) or you can copy and past into here, but make sure to surround your code with three and then the word "java" and end with three

Michel Bourgeois
Michel Bourgeois
731 Points

Here is my code https://w.trhou.se/e38ofea7x0

but do not understand what you mean ...surround my code with three....?

Thanks!

Michel Bourgeois
Michel Bourgeois
731 Points

My code is working now but really appreciate your advice. I will know it for the next time.