Online Java Compiler By
JavaTpoint.com
import java.util.*; public class LocaleGetDisplayCountryExample5 { public static void main(String[] args) { // Creating the Locales Locale locale1 = new Locale("German", "AU"); Locale locale2 = new Locale("Spanish", "EC"); // display locale System.out.println("Locale1 name: "+ locale1); System.out.println("Locale2 name: "+ locale2); //Use of getDisplayCountry(Locale in) System.out.println("Country name of in locale1: " + locale1.getDisplayCountry(new Locale("French", "France"))); System.out.println("Country name of in locale2: " + locale2.getDisplayCountry(new Locale("GERMAN", "GERMANY"))); } }
Output