getCountry() method Example

getCountry() method Example


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

In this tutorial you will learn how to use getCountry() method in java.

getCountry() method Example

In this tutorial you will learn how to use getCountry() method in java.

getCountry() is a method of Locale class that returns the country code.

syntax :

public String getCountry();

Example :

GetCountry.java

package devmanuals.com;

import java.util.Locale;

public class GetCountry
{
public static void main(String args[])
{
Locale loc = new Locale("ENGLISH", "UK");
String countryCode = loc.getCountry();
System.out.println("Country code : " + countryCode); 
}

}

Output :

When you will execute this 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