路人

导航

<2024年4月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

统计

常用链接

留言簿

随笔档案(39)

相册

搜索

积分与排名

最新评论

阅读排行榜

评论排行榜

re: 晕~搞了45分钟 山岗 2005-12-29 16:06
呵呵~严重感谢流行大哥指点~

import java.lang.*;

public class string {
public static void main(String[] agrs) {
String str = new String("asdaf");
int x = 1;
for (int i = 0; i < str.length(); i++) {
char a = str.charAt(i);
if (a == '&') {
x = 2;
break;
}
}
if (x == 2) {
System.out.println("有&");
} else {
System.out.println("没有&");
}
}
}