Locale.clone() has the following syntax.
public Object clone()
In the following code shows how to use Locale.clone() method.
import java.util.Locale; /*from w w w . j a v a 2 s . c om*/ public class Main { public static void main(String[] args) { Locale locale1 = new Locale("ENGLISH", "US"); // print this locale System.out.println("Locale1:" + locale1); // create a second locale Locale locale2; // clone locale1 to locale2 locale2 = (Locale) locale1.clone(); System.out.println("Locale2:" + locale2); } }
The code above generates the following result.