String srt = "woyaoxuejava,xihuanjava,aijava,javajavawozuiai";
char[] ch = srt.toCharArray();
int x = 0;
for (int i = 0; i < ch.length; i++) {
String a = ch[i] + "";
System.out.println(a == "j");
if (a == "j") {
x++;
}
}
System.out.println(x);
做String a = ch[i]+"";的是候不是应该在字符串常量池添加一个a的字符串吗?
然后到了后面判断的是候应该直接会定为两地址相同才对,为什么会是false
HELP |
|