Online Java Compiler By
JavaTpoint.com
import java.util.*; public class JavaLocaleExample2 { public static void main(String[] args) { // create a new locale Locale locale1 = new Locale("ENGLISH", "US", "WIN"); // print locale1 System.out.println("Locale1 name: " + locale1); // Use of toString() System.out.println("String representation of Locale1: " + locale1.toString()); // create a new locale Locale locale2 = new Locale("fr", "FRANCE", "WIN"); // print locale2 System.out.println("Locale2: " + locale2); // Use of toString() System.out.println("String representation of Locale2: " + locale2.toString()); } }
Output