## 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!

### 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.

# I need help with task 2. I give out best answers.

Correct the existing hasTile method to return true if the tile is in the tiles field, and false if it isn't. You can solve this a few ways, however, I'd like you to practice returning the result of the expression that uses the index of a char in a String.

ScrabblePlayer.java
```public class ScrabblePlayer {
// A String representing all of the tiles that this player has
private String tiles;

public ScrabblePlayer() {
tiles = "";
}

public String getTiles() {
return tiles;
}

// TODO: Add the tile to tiles
tiles += tile;
}

public boolean hasTile(char tile) {
// TODO: Determine if user has the tile passed in
boolean hh = answer.indexOf(tile) != -1;
}
if (hh){
}

}
```

Hi Jack,

You've pretty much got this done. There's just a couple of points.

First, ditch your new variable `answer`. You don't need it.

Second use the expression you've created on `tiles` using dot notation as you have done. Return the result of that expression.

Let me know how you get on.

Steve.

I don't get what you mean when you say "Second use the expression you've created on tiles using dot notation as you have done. Return the result of that expression."

OK - you created an expression - `.indexOf(tile) != -1`. that's correct. Chain it onto `tiles` using the dot notation just like you've chained it to `answer`. So replace `answer` with `tiles`. Last, add the keyword `return` before all that.

So, the method will have one line in it. It starts with `return` then has the above expression after that.

Steve.

```public class ScrabblePlayer {
// A String representing all of the tiles that this player has
private String tiles;

public ScrabblePlayer() {
tiles = "";
}

public String getTiles() {
return tiles;
}

// TODO: Add the tile to tiles
tiles += tile;
}

public boolean hasTile(char tile) {
// TODO: Determine if user has the tile passed in
return boolean hh = tiles.indexOf(tile) != -1;
}

}
```

Is this correct?

Not quite.

Return what you are assigning into `hh`.

The expression, as you know, evaluates to a boolean value. Just return it; don't assign it into anything. Remove `boolean hh =` so you just `return` the evaluated expression.

Steve.

Hi Jack - did you find the solution here or should I add some more help?

Steve.

I found the answer. You helped me better than anyone has yet out of my many posts.

Jack, I'm always happy to help. You can @ mention me in here, if you want to get hold of me. I do have a day job and we may be in different time zones, but I'll answer as soon as I can.

Where do you live? Does that mean that I can put @ Steve Hunter into my question whenever I want you to answer my questions?

I'm in the UK - 21:42 here now. So we're a good few hours apart!