Javatpoint Logo
Javatpoint Logo

CloneNotSupportedException in Java with Examples

In Java, the CloneNotSupportedException is an exception that indicates that an attempt to clone an object has failed because the object does not implement the Cloneable interface. The Cloneable interface is a marker interface that indicates that an object can be cloned. When an object not implementing Cloneable is cloned, Java throws the CloneNotSupportedException.


Here is the hierarchy of the CloneNotSupportedException class:

As you can see from the hierarchy, the CloneNotSupportedException extends the Exception class, which in turn extends the Throwable class. A Java program can catch and handle the CloneNotSupportedException, an exception type.

A try-catch block can be used to handle this Exception, or it can be specified to be thrown in the method's signature using the throws keyword.


The syntax of CloneNotSupportedException in Java is:

Example of CloneNotSupportedException :



Dog [Breed=Labrador Retriever, Age=3]
Cloning not supported: Cloning not supported for class Dog.

java.lang.CloneNotSupportedException: Cloning not supported for class Dog.
	at Dog.clone(
	at CloneNotSupportedExceptionDemo.main(

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA