[英]Error: unexpected type, required: variable and found: value
You must use ==
instead of =
.您必须使用
==
而不是=
。
In Java, we can compare two characters either by using the equals ==
operator or the equals()
method of the Character
class.在 Java 中,我们可以使用 equals
==
运算符或Character
类的equals()
方法来比较两个字符。
In your case:在你的情况下:
if (inputString.charAt(i) == 'a') {
...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.