实现对字符串数组{"Allen","Smith","James","Martin","Ford"} 求得包含字母a的所有的名字

public class Test4 {

public static void main(String[] args) {
func7();
}
public static void func7(){
String[] str = {"Allen","Smith","James","Martin","Ford"};
String st = null;
for(int i=0;i<str.length;i++){
if(str[i].contains("a")|str[i].contains("A")){
st = str[i];
System.out.println(st);
}
}
}
}

posted on 2017-11-29 15:01  acaca  阅读(181)  评论(0编辑  收藏  举报