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