[英]How to type String content:encoded = “Hello”; in java?
How to type String content:encoded = "Hello";
如何输入
String content:encoded = "Hello";
in java ? 在java中? Eclipse keep telling me syntax error on tokens delete these tokens ?
Eclipse不断告诉我令牌的语法错误会删除这些令牌吗?
setDescription(String content:encoded) {
_description = content:encoded;
}
Because content:encoded
is a syntax error. 因为
content:encoded
是语法错误。 Name in java only accept letters numbers $
and "_". Java中的名称仅接受字母数字
$
和“ _”。 The rule might allow some other characters but it should be pretty much it. 该规则可能允许其他一些字符,但应该差不多。 Also a variable cannot start with a number.
另外,变量不能以数字开头。
To be clear, remove the :
from the variable name because :
is illegal in a name and might have an other meaning in the language. 为了清楚起见,请从变量名称中删除
:
,因为:
在名称上是非法的,并且在语言中可能还有其他含义。
Quote from the article below: 引用以下文章:
- Variable names are case-sensitive.
变量名称区分大小写。 A variable's name can be any legal identifier — an unlimited-length sequence of Unicode letters and digits, beginning with a letter, the dollar sign
$
, or the underscore character_
.变量的名称可以是任何合法的标识符-无限长度的Unicode字母和数字序列,以字母,美元符号
$
或下划线字符_
开头。 The convention, however, is to always begin your variable names with a letter, not$
or_
.但是,约定是,变量名始终以字母开头,而不是
$
或_
。 Additionally, the dollar sign character, by convention, is never used at all.另外,按照惯例,完全不使用美元符号字符。 You may find some situations where auto-generated names will contain the dollar sign, but your variable names should always avoid using it.
您可能会发现某些情况,其中自动生成的名称将包含美元符号,但您的变量名称应始终避免使用它。 A similar convention exists for the underscore character;
下划线字符存在类似的约定; while it's technically legal to begin your variable's name with
_
, this practice is discouraged.虽然以
_
开头变量名称在技术上是合法的,但不建议这样做。 White space is not permitted.不允许使用空格。
- Subsequent characters may be letters, digits, dollar signs, or underscore characters.
后续字符可以是字母,数字,美元符号或下划线字符。
Here read more about it: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/variables.html 在这里阅读有关它的更多信息: http : //docs.oracle.com/javase/tutorial/java/nutsandbolts/variables.html
if you are creating method setDescription then it whould be: 如果要创建方法setDescription,则可能是:
public void setDescription(String content_encoded) {
_description = content_encoded;
}
Here 这里
modifier
modifier
return type
return type
parameter type
parameter type
Variable
that is holding string value. Variable
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.