Get a list of all Java reserved Keywords
问题 I'm looking for a way to retrieve all the saved keywords in Java into some kind of data structure. For example: "for, while, if, else, int, double, etc." I need to do a name validation on a string, to be specific, I need to make sure it does not equal to any java keywords. Is there a specific way of retrieving all the keywords into one data structure? or do I need to just build a regex string with all these keywords in it : "for|while|if|..." and try and match my string against it? Thanks 回答1