Java Locale getISO3Language() Example
Locale class getISO3Language() method example. This example shows you how to use getISO3Language() method.
Syntax is : public String getISO3Language()
Method returns a three-letter abbreviation for this locale's language. If the locale doesn't specify a language, this will be the empty string. Otherwise, this will be an uppercase ISO 3166 3-letter country code.
For more language codes visit : http://www.loc.gov/standards/iso639-2/englangn.html
Here is the code.
/**
* @(#) GetISO3LanguageLocale.java
* A class representing use of method getISO3Language() of Locale class
in java.util Package.
* @Version 24-May-2008
* @author Rose India Team
*/
import java.util.*;
class GetISO3LanguageLocale {
public static void main( String args[] ){
/* Create object of Locale class using contructor
Locale(String language, String country) */
Locale obj1 = new Locale("en","US");
Locale obj2 = new Locale("fr","FR");
System.out.println("object obj1 of Locale class is : "+obj1);
System.out.println("object obj2 of Locale class is : "+obj2);
// getISO3Language() method call.
String lang = obj1.getISO3Language();
System.out.println("Three-letter abbreviation for Object obji: "+lang);
lang = obj2.getISO3Language();
System.out.println("Three-letter abbreviation for Object obj2: "+lang);
}
} |
Output of the program.
object obj1 of Locale class is : en_US
object obj2 of Locale class is : fr_FR
Three-letter abbreviation for Object obji: eng
Three-letter abbreviation for Object obj2: fra |
|