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.Start your free trial
Hassaan Ahmad1,979 Points
Why is playNext() method made public when it could've been made private as other methods?
playNext() method is made public even when it is only being called from another public method of the same class. Isn't it better to make it private as it is not being accessed directly anywhere out of the KaraokeMachine class?
Steven Parker228,025 Points
Wow, old question. It may be that only the folks tagged will ever see the new comment.
But even if the current implementation only calls a method from inside the same class, one reason to make it public might be if it serves a function that might be of use to future code.
I suspect that's what the instructor had in mind when he said "Let's make it public, so anybody can call this one, if they wanted to."