
Collator 객체는 기본적으로 시스템 로캘을 사용합니다. 따라서 로캘을 설정하지 않은 Collator 객체에서 getLocale() 메서드를 호출하면 시스템 로캘이 반환됩니다.
예를 들어, Windows 시스템에서 로캘을 설정하지 않은 Collator 객체를 생성하면 getLocale() 메서드는 "en_US" 또는 "ko_KR"와 같은 시스템 로캘을 반환합니다.
Collator 객체의 로캘을 변경하려면 setLocale() 메서드를 사용해야 합니다.
예시:
#hostingforum.kr
java
Collator collator = Collator.getInstance();
Locale locale = collator.getLocale(); // 시스템 로캘 반환
collator.setLocale(Locale.KOREA); // 로캘 설정
locale = collator.getLocale(); // 설정된 로캘 반환
2025-05-01 08:02