Javatpoint Logo
Javatpoint Logo

Java Calendar Clone() Method

The 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.

Syntax

Parameter

This method does not accept any value.

Returns

This method returns the copy of this object.

Throws

CloneNotSupportedException.

Example 1

Test it Now

Output:

Actual Calendar Object : Mon Jul 30 09:28:59 PDT 2018
Cloned calendar object : Mon Jul 30 09:28:59 PDT 2018

Example 2

Test it Now

Output:

Mon Jul 30 09:39:08 PDT 2018
Cloned calendar object: Fri Jul 30 09:39:08 PDT 2027

Example 3

Test it Now

Output:

Mon Jul 30 09:42:52 PDT 2018
Cloned calendar object : Fri Nov 30 09:42:52 PST 2018

Example 4

Test it Now

Output:

Mon Jul 30 09:47:25 PDT 2018
Cloned calendar object : Mon Oct 24 15:53:25 PDT 2022



Help Others, Please Share

facebook twitter pinterest