What are the valid characters for a Java method name?
问题 I read about the naming of Java variables. It says that Java variables cannot start with any numbers and special characters except for $ and _. Some valid examples: int count; int _count; int $count; And some invalid examples: int %count; int 4count; int #count; Do the same rules apply to method names? 回答1: Yes, method names and variable names are what's called "identifiers". Identifiers all share the same rules regarding accepted characters. Take a look at §3.8 from the Java Language