第五章第五十题(对大写字母计数)(count the uppercase letters)
- *5.50(对大写字母计数)编写一个程序,提示用户输入一个字符串,然后显示该字符串大写字母的数目。
Enter a string: Welcome to Java
The number of uppercase letters is 2
*5.50 (count the uppercase letters) Write a program that prompts the user to enter a string,And displays the number of uppercase letters in the string.
Enter a string: Welcome to Java
The number of uppercase letters is 2 - 参考代码:
package chapter05;
import java.util.Scanner;
public class Code_50 {