clone(): This method is available in java.util.Date class of Java.
Syntax:
Object java.util.Date.clone()
This method returns a copy of this object.
Parameters: NA
Returns: a clone of this instance.
Exceptions: NA
Approach
Java
import java.util.Date;public class Dateclone {public static void main(String[] args) {Date date = new Date();System.out.println(date.clone());}}
Output:
Sun Jan 30 17:45:13 IST 2022
No comments:
Post a Comment