clone() 方法用于返回此SimpleTimeZone实例的一个副本。
声明
以下是java.util.SimpleTimeZone.clone()方法的声明。
public Object clone()
参数
-
NA
返回值
方法调用返回此实例的一个克隆。
异常
-
NA
例子
下面的例子显示java.util.SimpleTimeZone.clone()方法的使用
package com.yiibai; 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]