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