What are the valid characters for a Java method name?

前端 未结 3 1734
广开言路
广开言路 2021-02-08 15:02

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:

3条回答
  •  后悔当初
    2021-02-08 15:16

    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 Specification to find out exactly what an identifier may contain, and §6.2 for an explanation about how identifiers are used.

提交回复
热议问题