变量名称上的Java#字符 [英] Java # character on variable names
本文介绍了变量名称上的Java#字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,
我正在学习Java基础课程,并且我想出了一个混乱的特征,即最近在Java上分配变量名称#。我上网了很多,但我找到的只是oprerators,不允许使用关键字和保留字。那么为什么Java中的变量名称不允许#。示例 - 不允许将##作为变量名。
提前感谢。
解决方案
请参阅我对该问题的评论。
请记住,Java不是标准化的: http:// en.wikipedia.org/wiki/Java_%28programming_language%29 [ ^ ]。
许多地方都解释了标识符的Java语法。例如:
http://home.cogeco.ca/~ve3ll/jatutor2.htm [ ^ ]。
如果需要,可以搜索Oracle或其他第一手资料。我不认为这是一个非常重要的问题。标识符的Java语法非常传统。 为什么这个问题并不完全正确。这是人类文化的一部分。更正确的问题是:你想提出更好的语法吗?为什么?它有什么好处?
-SA
Hello,
I am taking Java fundamental course and I've came up with a confused character i.e # on assigning variable name on Java lately. I have surfed the internet a lot but all I could find is only oprerators, keyword and reserved words are not allowed. so why is # not allowable on variable name in Java. Example - total # is not allowed as a variable name.
Thanks in advance.
解决方案
Please see my comments to the question.
Remember that Java is not standardized: http://en.wikipedia.org/wiki/Java_%28programming_language%29[^].
And the Java syntax for identifiers is explained in many places. For example:
http://home.cogeco.ca/~ve3ll/jatutor2.htm[^].
If you want, search Oracle or other first-hand sources. I don't think this is a very principal issue. Java syntax for identifiers is very traditional. The question "why" is not quite correct. This is a part of human culture. The more correct questions would be: "Would you like to propose better syntax? Why? What would be the benefits of it?"
—SA
这篇关于变量名称上的Java#字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文