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 trialStephanie Fu
1,939 PointsCan someone explain this lesson to me?
I understand that this video was about fixing the "no letter" bug, but why did Craig have to create a new method? Couldn't he have just modified the old applyGuess method to accept a string and throw an exception?
1 Answer
alexmearns
1,537 PointsHi Stephanie, as per Sina. You are correct the applyGuess method could've just been modified to accept a string, but by using method overloading (two methods with the same name that accept different inputs) the application is able to accept both a string or a char which your solution wouldn't do. Alex
Sina Maleki
6,135 PointsSina Maleki
6,135 PointsHi Stephanie Fu. Craig create a new method because he wants to have two method with two responsibility, one of them works with strings and the other one works with characters. Best