Locale.getVariant() has the following syntax.
public String getVariant()
In the following code shows how to use Locale.getVariant() method.
// w ww. j a v a 2 s . c om import java.util.Locale; public class Main { public static void main(String[] args) { Locale locale = new Locale("en", "US", "WIN"); System.out.println("Locale:" + locale); // get variant and print it System.out.println("Language:" + locale.getVariant()); } }
The code above generates the following result.