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