分配的左边必须是一个变量 [英] Left-hand side of assignment must be a variable
本文介绍了分配的左边必须是一个变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想打电话给一个布尔方法在另一个类和Eclipse是报告在以下code中的第二行上述错误:
I'm trying to call a boolean method in another class and Eclipse is reporting the above error on the second line in the following code:
CCR ccrFlags = new CCR();
if (ccrFlags.cBit() = set)
这是被称为CCR之类被调用的方法是:
The method being called from the class called "CCR" is:
public boolean cBit() {
boolean set = false;
return set;
}
我想我可能以愚蠢的方式去这件事,将是任何建议表示感谢。谢谢,罗伯特。
I imagine I'm probably going about this in an idiotic way and would be grateful for any advice. Thanks, Robert.
推荐答案
比较应该用 ==
(双相等):
Comparison should use ==
(double-equal):
CCR ccrFlags = new CCR();
if (ccrFlags.cBit() == set)
这篇关于分配的左边必须是一个变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文