그래서 오늘 오후에 Java를 배우기 시작했습니다. 이 일을하는 가장 좋은 방법은 무엇입니까? 그리고 내가 뭘 잘못 했니? 순간, 난 그냥 아무 출력 :(자바다른 모든 문자를 대문자로 변환합니다. 즉, abcd -> aBcD
import java.util.Scanner;
class ClassA {
public static void main(String[] args) {
Scanner MyScan = new Scanner(System.in);
System.out.print("Enter Word: ");
String UI = MyScan.nextLine();
UI.toLowerCase();
String s;
String word = "";
for (int i = 0; i <= UI.length()-1; i++) {
s = UI.substring(i, i+1);
if (i % 2 == 1) {
s.toUpperCase();
}
word.concat(s);
}
System.out.print(word);
MyScan.close();
}
}