Results 1 to 2 of 2
Thread: Cloneable interface
- 02-01-2012, 01:33 AM #1
Senior Member
- Join Date
- Jan 2012
- Posts
- 210
- Rep Power
- 10
Cloneable interface
If say:
Java Code:public class Circle extends GeometricObject implements Cloneable { private double radius; @Override protected Object clone() { Circle c = null; try { c = (Circle) super.clone(); } catch (CloneNotSupportedException e) { } return c; } }
Where can I find that implementation?
- 02-01-2012, 10:55 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 13,541
- Rep Power
- 27
Re: Cloneable interface
It's a native operation.
It essentialy copies the contents of the object it's been called on (a shallow copy).
Unless the object in question does not implement Cloneable in which case it throws an exception.
This is all in the documentation for clone().
Similar Threads
-
Why is clone() not in the Clonable Interface?
By garyiskidding in forum Advanced JavaReplies: 4Last Post: 05-29-2011, 04:27 AM -
interface help
By alpdog14 in forum New To JavaReplies: 3Last Post: 05-04-2011, 12:17 PM
Bookmarks