The setLocale() method of java.text.MessageFormat class is used to set the new locale in this message format object.
public void setLocale(Locale locale)
Parameter: This method takes new locale object as a parameter.
Return Value: This method has nothing to return
Below are the examples to illustrate the setLocale() method:
Locale is : en-us
Locale is : zh-hant-tw
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.