Java SimpleTimeZone.clone() method example

 Posted On  | Pooja Lakkihal 

In this tutorial, You will learn how to get a clone of this SimpleTimeZone object . Java SimpleTimeZone.clone() method returns a clone of this instance.

Returns a clone of this SimpleTimeZone instance.

syntax

public Object clone()

Returns

A clone of this instance.

Java SimpleTimeZone clone() example

  • new SimpleTimeZone(100, "INDIA"); It will construct a SimpleTimeZone with the given base time zone.
  • simpleTimeZone.clone(); It will return a clone of this SimpleTimeZone instance.
package com.technicalkeeda;

import java.util.SimpleTimeZone;

public class App {

    public static void main(String[] args) {

        SimpleTimeZone simpleTimeZone = new SimpleTimeZone(100, "INDIA");

        System.out.println("Original Object :-  " + simpleTimeZone);

        Object cloneObject = simpleTimeZone.clone();
        System.out.println("Clone Object :-  " + cloneObject);
    }
}

output

Original Object :-  java.util.SimpleTimeZone[id=INDIA,offset=100,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 Object :-  java.util.SimpleTimeZone[id=INDIA,offset=100,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]


© technicalkeeda.com 2018

 |  Find us on Google+ |  Rss Feed

Loaded in 0.0386 seconds.