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 :
[ 0 ] Comments