public class Test {
public static void main(String[] args) {
String s = "hello world";
String[] arr = s.split(" ");
StringBuffer sb = new StringBuffer();
for (int i = 0; i < arr.length; i++) {
sb.append(arr[i].substring(0, 1).toUpperCase().concat(arr[i].substring(1).toLowerCase()));
}
System.out.println(sb);
}
}
public class 题目 {
public static void main(String[] args) {
String s = "hello world";
char[] cha = s.toCharArray();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < cha.length; i++) {
if (cha[i]=='h') {
cha[i]='H';
}
if (cha[i]=='w') {
cha[i]='W';
}
sb.append(cha[i]);
}
System.out.println(sb);