我在课本上看到了这个,想知道它是什么以及何时知道使用它。
public class TV{
public static final int MAX.VOLUME = 10;
public static final int DEFAULT.CHANNEL = 2;
public static final int DEFAULT.VOLUME = 4;
最佳答案
在java中,定义变量名是有一定规则的。
A variable name must not,
- 是一个 java 关键字
- 包含空格
The first character of a variable name,
- 可以是一个字符 (
a-z|A-Z
) - 可以是美元符号 (
$
) - 可以为下划线 (
_
) - 不能是数字 (
0-9
)
The rest of the name can contain any combination from the following,
- 字符(
a-z|A-Z
) - 美元符号 (
$
) - 下划线 (
_
) - 数字 (
0-9
)
<小时/>All variable names are case-sensitive.
因此在变量名中间使用句点 (.
) 将导致编译错误。
关于java - 变量名中的句点意味着什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55766934/