编辑代码

public class UpperCase {
	public static void main(String args[]){
		int count = 0; 
		String str = "My name is Tom, I come from China";
		for(int i=0; i<str.length(); i++){
			Character cc = str.charAt(i); 
			boolean d = Character.isUpperCase(cc);
			if(d){
				count++;
			}
		}
		System.out.println("字符串 "+str+" 中包含"+count+"个大写字母!");
	}
}