import java.util.Scanner; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); // 注意next只能读取到空格前的内容,因此要用nextLine String sentence = in.nextLine(); String[] words = sentence.split(" "); for (String w : words) { char firstChar = w.charAt(0); // 这里的toUpperCase()是Character的静态方法,注意与String的实例方法调用不同 System.out.print(Character.toUpperCase(firstChar)); } } }