In this tutorial you will learn how to use getDisplayName() method in java.
getDisplayName() method example
In this tutorial you will learn how to use getDisplayName() method in java.
getDisplayName() is a method of Locale class that returns the locale's name.
syntax :
public final String getDisplayName();
Example :
package devmanuals.com;
import java.util.Locale;
public class GetDisplayName
{
public static void main(String args[])
{
Locale loc[]= Locale.getAvailableLocales();
System.out.println("Language (Variant) : \n");
for(int i=0; i<loc.length; i++)
{
System.out.println(loc[i].getDisplayName());
}
}
}
Output :
When you will execute the above example you will get the output as :


[ 0 ] Comments