Java.util.Locale.setDefault() 方法


Java.util.Locale.setDefault() 方法

package com.codingdict;

import java.util.*;

public class LocaleDemo {
   public static void main(String[] args) {

      // create a new locale
      Locale locale1 = new Locale("en", "US", "WIN");

      // print locale
      System.out.println("Locale:" + locale1);

      // set another default locale
      Locale.setDefault(new Locale("fr", "FRANCE", "MAC"));

      // create a new locale based on new default settings
      Locale locale2 = Locale.getDefault();

      // print the new locale
      System.out.println("Locale::" + locale2);
   }
}