1. Make your class final (so that no cloneable sub-class can be created)
2. In case of non-final class, Override the clone method of Object
class in your class and inside the body of the method just throw a
CloneNotSupportedException.
ex:
public final class MyClass
{
protected Object clone() throws CloneNotSupportedException
{
throw new CloneNotSupportedException();
}
}
Build Your Own Test Framework
-
[image: Build Your Own Test Framework]
Learn to write better automated tests that will dramatically increase your
productivity and have fun while doing so...
2 hours ago
No comments:
Post a Comment
I'm certainly not an expert, but I'll try my hardest to explain what I do know and research what I don't know.