# [JAVA] 대문자와 소문자

> 문자열 my_string이 매개변수로 주어질 때, 대문자는 소문자로 소문자는 대문자로 변환한 문자열을 return하도록 solution 함수를 완성해주세요.

---

### ◇ 내 답변

```
class Solution {
    public String solution(String my_string) {
        String answer = "";
        
        for (int i = 0; i < my_string.length(); i++) {
            if (Character.isLowerCase(my_string.charAt(i))) {
                answer += Character.toUpperCase(my_string.charAt(i));
            } else {
                answer += Character.toLowerCase(my_string.charAt(i));
            }
        }
        
        return answer;
    }
}
```

isLowerCase, isUpperCase

toLowerCase, toUpperCase

둘다 문자니 Character 클래스

For the site tree, see the [root Markdown](https://slashpage.com/%EB%AC%B4%EB%91%A5-rypb2.md).
