In this tutorial you will learn how to use getDisplayCountry() method in java.
getDisplayCountry() method example
In this tutorial you will learn how to use getDisplayCountry() method in java.
getDisplayCountry() is a method of Locale class that returns the locale's country name.
syntax :
public final String getDisplayCountry();
Example :
package devmanuals.com; import java.util.Date; import java.util.Locale; public class GetDisplayCountry { public static void main(String[] args) { Date today = new Date(); Locale[] locales = { Locale.US, Locale.UK, Locale.GERMANY, Locale.FRANCE }; System.out.println("Name of Locale countries are :\n"); for (int i = 1; i <= locales.length; i++) { System.out.println(i+"."+locales[i-1].getDisplayCountry()); } } }
Output :
When you will execute the above example you will get the output as :
[ 0 ] Comments