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 (Retired) Creating the MVP Strings and Chars

creating the mvp

hie everybody, can someone help me here. i am receivng an error message that says " reached end of line while parsing"

ScrabblePlayer.java
public class ScrabblePlayer {
    private String mHand;

    public ScrabblePlayer() {
        mHand = "";
    }

    public String getHand() {
       return mHand;
    }

    public void addTile(char tile) {
        // Adds the tile to the hand of the player
      mHand += tile;

    }

    public boolean hasTile(char tile) {
      boolean currentHand = mHand.indexOf (tile) >=0;
      if (currentHand) {
        return true;
      } else {
       return false;
    }
}
Yonatan Schultz
Yonatan Schultz
12,045 Points

You're missing a closing bracket for your hasTile method. Try checking your code in SublimeText. It has a really nice feature which shows the matching bracket when you select a bracket.

2 Answers

Logan R
Logan R
22,989 Points

You are missing your } after your else block in the last method.

    public boolean hasTile(char tile) {
      boolean currentHand = mHand.indexOf (tile) >=0;
      if (currentHand) {
        return true;
      } else {
       return false;
      }
    }
}

thank you so much Yonatan, thank you so much Logan. i got it....and its green for Go