フリー問題

Java SE 21 Developer Professional のフリー問題 4 / 20 問目

問題文

Which expression is the recommended way to obtain a Locale for a language and country pair in Java 21?

選択肢

  1. 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.
  2. A call to new Locale with those two codes, which the current documentation still recommends while any new code is being written today.
  3. Locale.of with the language code and the country code as its arguments, which is the form that replaced the older constructor there.
  4. 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.

解答・解説を確認するには

正解と解説の確認、回答の記録には無料登録が必要です。登録すると演習モードでフリー問題に回答し、正誤と解説をその場で確認できます。