
NumberFormatter 클래스의 getLocale() 메소드는 지역 설정을 반환하는 메소드입니다.
Locale 객체를 반환하여, 지역 설정을 확인할 수 있습니다.
예를 들어, 다음과 같이 사용할 수 있습니다.
#hostingforum.kr
java
NumberFormatter formatter = NumberFormatter.of("###,###.##");
Locale locale = formatter.getLocale();
System.out.println(locale); // 예: en-US
getLocale() 메소드는 지역 설정을 변경하지 않습니다. 지역 설정을 변경하려면 setLocale() 메소드를 사용해야 합니다.
#hostingforum.kr
java
NumberFormatter formatter = NumberFormatter.of("###,###.##");
formatter.setLocale(Locale.KOREA);
System.out.println(formatter.getLocale()); // 예: ko-KR
getLocale() 메소드를 사용하여 지역 설정을 변경한 후, 다시 getLocale() 메소드를 호출하면 기존 지역 설정이 유지됩니다.
#hostingforum.kr
java
NumberFormatter formatter = NumberFormatter.of("###,###.##");
formatter.setLocale(Locale.KOREA);
System.out.println(formatter.getLocale()); // 예: ko-KR
System.out.println(formatter.getLocale()); // 예: ko-KR
getLocale() 메소드는 지역 설정을 반환하는 메소드이므로, 지역 설정을 변경하려면 setLocale() 메소드를 사용해야 합니다.
2025-03-11 13:53