Java Format - Java SimpleDateFormat.clone()








Syntax

SimpleDateFormat.clone() has the following syntax.

public Object clone()

Example

In the following code shows how to use SimpleDateFormat.clone() method.

import java.text.SimpleDateFormat;
//from w  w w.j  av a  2  s.co m
public class Main {
  public static void main(String[] argv) throws Exception {

    SimpleDateFormat formatter = new SimpleDateFormat();
    formatter.applyPattern("MMM");
    
    System.out.println(formatter.clone().equals(new SimpleDateFormat()));
  }
}

The code above generates the following result.