問題文
Which expression is the recommended way to obtain a Locale for a language and country pair in Java 21?
選択肢
- Locale.getDefault with the language code and the country code as its arguments, which returns a locale derived from the one that the platform is currently using.
- A call to new Locale with those two codes, which the current documentation still recommends while any new code is being written today.
- Locale.of with the language code and the country code as its arguments, which is the form that replaced the older constructor there.
- Locale.forLanguageTag with the language code and the country code passed as two separate arguments so the tag is assembled by the library itself, while the tag form takes a single string.