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 trialMichelle Vanwagenen
5,614 PointsWhat does it mean when is says a "create the method getTileCount that excepts a char?"
In reference to the For Each Loop code challenge. I feel like I'm so close, but this is the correction it gives me. I am just getting more confused.
2 Answers
Kathryn Ann
10,071 PointsHi Michelle - I'm not sure whether you're looking for a detailed explanation or just a hint in the right direction, but you need to create a getTileCount() method that accepts a char as an argument and then uses a loop to get a count of tiles with the character you specify. For example, if you called the method as getTileCount('a'), the method would loop through the tiles in your hand and count each 'a', then return that number.
Michelle Vanwagenen
5,614 PointsThank you Kathryn, I really just wanted a hint. I didn't understand the part where it talks about accepting the character. You listed above that it is an argument. I was able to rethink what was being asked and applied it correctly. Thank You!!
Kathryn Ann
10,071 PointsHi Emanuel - You might have figured out your answer already, but yes, that looks like the correct way to declare the method!
mannyaharon
873 Pointsmannyaharon
873 PointsHi Kathryn, I seem to be stuck as well. When creating the getTileCount() method, would you declare it like so:
public int getTileCount(char foo){ }
?The reason I added the int is because I assumed the output of the method will be a number of how many times that character is found within the player's tiles?