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 Current Progress

gurveer aulakh
gurveer aulakh
2,800 Points

help me to solve the errors in my code pls!!

I am getting 14 frustrating errors in my code but I believe I did the same thing as I have to do .Thought below is my code: https://w.trhou.se/a3qnxb4400 pls, let me know where am I making mistakes.

The link you have provided does not link to any java code, it only links to your user profile.

gurveer aulakh
gurveer aulakh
2,800 Points

My bad this is the link for the code : https://w.trhou.se/a3qnxb4400. I updated to the main question too. Again sorry!!

2 Answers

in your Game.java I see this err

   char display = "-";

it should be

   char display = '-';

not the single quote

also

    for(char letter = answer.toCharArray()) {

should be

    for(char letter : answer.toCharArray()) {

this should solve the typos

hope this helps

gurveer aulakh
gurveer aulakh
2,800 Points

hey, thank you very much! it did work but I didn't get it that what is the differences between using single quote and in double quotes.

The single quote is reserved for Java type [char]. A char type is not the same thing as a String.

so ... "A" and a String and 'A' is a Char corresponding to unicode character as defined here: http://www.rapidtables.com/code/text/unicode-characters.htm

Please take a look here: https://docs.oracle.com/javase/8/docs/api/java/lang/String.html and here https://docs.oracle.com/javase/7/docs/api/java/lang/Character.html

and observe the differences between the two.

Hope this helps