getDisplayCountry() method example

getDisplayCountry() method example


Posted in : Java Posted on : November 23, 2011 at 6:53 PM Comments : [ 0 ]

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 :

Download Source Code

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics