[英]What am I doing wrong with this boolean?
boolean remindertextup = false;
remindertextup = text.contains("Unavailable");
if (value.contains("yes") && (remindertextup = true)){
//statement
}
But the if statement still works if text does not contain unavailable and value contains yes. 但是如果text不包含不可用且值包含yes,则if语句仍然有效。
What am am I doing wrong? 我做错了什么?
Thank you. 谢谢。
PS: Eclipse shows the boolean remindertextup to be never used. PS:Eclipse显示从不使用的布尔提醒文本。
What you wrote in the if
clause sets remindertextup
to true
. 您在if
子句中编写的内容将remindertextup
设置为true
。 Change it to: 将其更改为:
(remindertextup == true)
In Java (like C and C++) '=' is an assignment. 在Java中(如C和C ++),'='是一个赋值。 Try 尝试
if (value.contains("yes") && (remindertextup == true))
{
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.