java.util.SimpleTimeZone.clone() 方法

描述

clone() 方法用于返回此 SimpleTimeZone 实例的克隆。


声明

以下是 java.util.SimpleTimeZone.clone() 方法的声明。

public Object clone()

参数

NA


返回值

方法调用返回此实例的克隆。


异常

NA


示例

下面的例子展示了 java.util.SimpleTimeZone.clone() 的用法。

package com.tutorialspoint;

import java.util.*;

public class SimpleTimeZoneDemo {
   public static void main( String args[] ) {
      
      // create simple time zone object 
      SimpleTimeZone stobj = new SimpleTimeZone(720,"India");
      System.out.println("Origial obj: " + stobj);

      // clone the object
      Object cloneObj = stobj.clone();
      System.out.println("Clone obj: " + cloneObj);
   }    
}

让我们编译并运行上面的程序,这将产生以下结果.

Origial obj: java.util.SimpleTimeZone[id = India,offset = 720,dstSavings = 3600000,
useDaylight = false,startYear = 0,startMode = 0,startMonth = 0,startDay = 0,
startDayOfWeek = 0,startTime = 0,startTimeMode = 0,endMode = 0,endMonth = 0,
endDay = 0,endDayOfWeek = 0,endTime = 0,endTimeMode = 0]

Clone obj: java.util.SimpleTimeZone[id = India,offset = 720,dstSavings = 3600000,
useDaylight = false,startYear = 0,startMode = 0,startMonth = 0,startDay = 0,
startDayOfWeek = 0,startTime = 0,startTimeMode = 0,endMode = 0,endMonth = 0,
endDay = 0,endDayOfWeek = 0,endTime = 0,endTimeMode = 0]