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
Geocarlos Alves
13,969 PointsCharacter.isJavaIdentifierStart(char)
I have used the method 'Character.isJavaIdentifierStart(char)' to pass the exercise in Java Objects / Delivering the MVP / Applying a Discount Code.
In this exercise, you should not allow numbers, however, you must allow '$'. So you cannot use Character.isLetter(char). I passed the exercise with Character.isJavaIdentifierStart(char), but I have wondered if I am supposed to allow ''? That is because if the user happens to use _ in their code, Character.isJavaIdentifierStart('') returns true.
Has anybody used a different method for this, or is this actually the one?