Monday 2 July 2018

How to use clone() method of Java.util.Date | Java Date and Time


Click here to watch on Youtube: 
https://www.youtube.com/watch?v=KNK8zY639z8&list=UUhwKlOVR041tngjerWxVccw

DateDemo.java

import java.util.Date;

public class DateDemo
{
    public static void main(String[] args)
    {
        Date date1 = new Date();
        System.out.println("Original Date = " + date1);

        /*
         * Return a copy of this object.
         */

        Object date2 = date1.clone();
        System.out.println("Cloned date   = " + date2);
    }

}

Output

Original Date = Sat May 12 09:40:54 IST 2018
Cloned date   = Sat May 12 09:40:54 IST 2018

Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/DateDemo_util_clone.zip?attredirects=0&d=1

Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/DateDemo_util_clone

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/bb275a728500f81507bdd46f6424332d29623c06/BasicJava_2018/DateDemo_util_clone/?at=master

See also:
  • All JavaEE Videos Playlist
  • All JavaEE Videos
  • All JAVA EE Links
  • Spring Tutorial
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • Java Collection Framework Tutorial
  • JAVA Tutorial
  • Kids Tutorial
  • Cooking Tutorial
  • No comments:

    Post a Comment