本程序的功能是找出字符串"My name is Tom, I come from China."中的大写字母,并打印输出。
public class exam_31{
public static void main(String[] args){
String str="My name is Tom, I come from China.";
______;
int i=0;
while(i<len){
char c=str.charAt(i);
if(______)
System.out.print(c+" ");
______;
}
}
}
【参考答案】
int len=str.length()
c>=’A’ && c<=’Z’
i++(或i=i+1或i+=1)