Java Calendar Clone() MethodThe clone() method is a method of object class and Object class is super class of all the classes of java. clone() method can be called for the object of calendar class also. Clone method returns the copy of the object. SyntaxParameterThis method does not accept any value. ReturnsThis method returns the copy of this object. ThrowsCloneNotSupportedException. Example 1Output: Actual Calendar Object : Mon Jul 30 09:28:59 PDT 2018 Cloned calendar object : Mon Jul 30 09:28:59 PDT 2018 Example 2Output: Mon Jul 30 09:39:08 PDT 2018 Cloned calendar object: Fri Jul 30 09:39:08 PDT 2027 Example 3Output: Mon Jul 30 09:42:52 PDT 2018 Cloned calendar object : Fri Nov 30 09:42:52 PST 2018 Example 4Output: Mon Jul 30 09:47:25 PDT 2018 Cloned calendar object : Mon Oct 24 15:53:25 PDT 2022 Next TopicJava-calendar-compareto-method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India