HttpCookie Clone() Example
Create and return a copy of this object.
HttpCookieclass Clone() method example. This example shows you how to use Clone() method.This method Create and return a copy of this object.
Here is the code:-
/*
* @Program that Create and return a copy of this object.
* Clone.java
* Author:-RoseIndia Team
* Date:-25-Jun-2008
*/
import java.net.*;
public class Clone {
public static void main(String[] args) throws Exception {
String name = "Name";
String value = "ABC";
HttpCookie hc = new HttpCookie(name, value);
//Create and return a copy of this object.
Object o = hc.clone();
System.out.println("Copy of this object is: " +o);
}
} |
Output of the program:-
| Copy of this object is: Name="ABC" |
|