[英]Is it neccessary that left-hand side of an assignment must be a variable?
public String toString() {
return " Recipient:"+ this.toString(this.getRecipient()) +
" CC:"+ this.toString
(
if(this.getCC()==null)
{
getCC() = "";
}
) +
" Subject:"+this.getSubject() +
" Body:"+ this.getBody() +
" files:"+ this.getFiles();
}
I am having this error in:我在以下方面遇到此错误:
getCC() = ""; getCC() = ""; <--------- Here.
<---------这里。
Do you know why is this happening?你知道为什么会这样吗? Thanks in advance
提前致谢
You can't assign a value to the return of a method.您不能为方法的返回值赋值。 You also can't place an expression inside a method which takes no arguments.
您也不能在不带参数的方法中放置表达式。 What you appear to have intended was to use a variable.
您似乎打算使用一个变量。
String cc = getCC();
if (cc == null) cc = "";
return ... " CC:" + cc + ...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.