Java Locale.getDisplayName()

Syntax

Locale.getDisplayName() has the following syntax.

public final String getDisplayName()

Example

In the following code shows how to use Locale.getDisplayName() method.


/* w w  w. j  a  v a  2s . c o  m*/

import java.util.Locale;

public class Main {

   public static void main(String[] args) {
      Locale locale = new Locale("ENGLISH", "US");

      System.out.println("Locale:" + locale);

      // print display name for locale
      System.out.println("Name:" + locale.getDisplayName());

   }
}

The code above generates the following result.