The clone() method of SimpleTimeZone class returns a clone of this SimpleTimeZone instance.
Syntax:
public Object clone()
Parameters: The function does not accept any parameter.
Return Value: Returns a clone of this instance.
Exception: The function does not throws any exception.
Program below demonstrates the above mentioned function:
Program 1:
// program to demonstrate the // function java.util.SimpleTimeZone.clone() import java.util.SimpleTimeZone; public class GFG { public static void main(String[] args) { // create simple time zone object SimpleTimeZone obj = new SimpleTimeZone(520, "India"); // clone the object and print System.out.println("Clone object : " + obj.clone()); } } |
Clone object : java.util.SimpleTimeZone [ id=India, offset=520, 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 ]
Program 2:
// program to demonstrate the // function java.util.SimpleTimeZone.clone() import java.util.SimpleTimeZone; public class GFG { public static void main(String[] args) { // create simple time zone object SimpleTimeZone obj = new SimpleTimeZone(120, "India"); // clone the object and print System.out.println("Clone object : " + obj.clone()); } } |
Clone object : java.util.SimpleTimeZone [ id=India, offset=120, 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 ]
Attention reader! Don’t stop learning now. Get hold of all the important Java and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.
Recommended Posts:
- SimpleTimeZone hashCode() method in Java with Examples
- SimpleTimeZone getRawOffset() method in Java with Examples
- SimpleTimeZone getDSTSavings() method in Java with Examples
- SimpleTimeZone getOffset() method in Java with Examples
- SimpleTimeZone equals() method in Java with Examples
- SimpleTimeZone hasSameRules() method in Java with Examples
- SimpleTimeZone setRawOffset() method in Java with Examples
- SimpleTimeZone toString() method in Java with Examples
- SimpleTimeZone setDSTSavings() method in Java with Examples
- SimpleTimeZone inDaylightTime() method in Java with Examples
- SimpleTimeZone setStartRule(int, int, int) method in Java with Examples
- SimpleTimeZone setEndRule(int, int, int) method in Java with Examples
- SimpleTimeZone setStartYear() method in Java
- SimpleTimeZone useDaylightTime() method in Java
- Vector clone() Method in Java with Examples
- ArrayList clone() method in Java with Examples
- Locale clone() Method in Java with Examples
- BitSet clone() Method in Java with Examples
- TimeZone clone() Method in Java with Examples
- SimpleDateFormat clone() Method in Java with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

