Java Date Time - Java TimeZone.clone()








Syntax

TimeZone.clone() has the following syntax.

public Object clone()

Example

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

/*from www.  j  a  v  a2  s  .  co  m*/
import java.util.TimeZone;

public class Main {
   public static void main( String args[] ){
       
      // create object of TimeZone class. 
      TimeZone timezoneobj = TimeZone.getDefault(); 
      System.out.println("Original object: " + timezoneobj);
   
      // cloning time zone object
      Object objClone = timezoneobj.clone();      
      System.out.println("Clone object: " + objClone);
   }    
}

The code above generates the following result.