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 trialMateusz Hyla
4,658 PointsI don't know witch what group I need to match matches which I already have.
Hi
I don't know if I understand in 100% text of challange. There is written that I should compare matches I already have in variable with something but there is not explained with which. I thought that method get thing we compare in parameter but I get error.
I still don't get why error box doesn't show me any error message. Is it broken somehow ?
Cheers
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) {
return mHand.indexOf(tile) > -1;
}
public int getTileCount(char tile){
int numOfMatches = 0;
for(char innerTile : mHand){
if(innerTile == tile ){
numOfMatches++;
}
}
return numOfMatches;
}
}
1 Answer
Christopher Augg
21,223 PointsMateusz,
You pretty much got this down. Hint: What method is it that you can call from a string that gives you an array of characters?
for(char innerTile : mHand.???){
Regards,
Chris