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 trialThomas Katalenas
11,033 PointsCan you please fill out the addTile method so that it takes the char that is passed and adds it to the mHand member fiel
mHand = tile
doesn't work?
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 false;
}
}
2 Answers
Seth Kroger
56,414 PointsmHand is a string that represents several tiles (or letters). Assigning mHand to be a single tile will replace any tiles already in the hand, not add to them. You want to add the tile character to the string instead.
mHand += tile;
Thomas Katalenas
11,033 Pointsthanks!!, wow I think java is not a bad language, however I think I can forsee alot of confusion running around from module to module looking for an object...uh wahaha I wonder about functional languages like clojure. thats written in java I think.