• Post Reply Bookmark Topic Watch Topic
  • New Topic

Cloneable and Clone...  RSS feed

 
Karthick Dharani Vidhya
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I need some clarifications on Cloneable marker interface.
Why was it designed in such a way that CLONEABLE interface is marker and the clone() method is sitting inside the java.lang.Object?
Why cant they have the clone() method inside cloneable interfaces?

Also what is the use of Marker interfaces without methods. Is this something to do with JVM???
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check this Thread

Karthick Dharani Vidhya wrote:what is the use of Marker interfaces without methods. Is this something to do with JVM???


Yes . you can write your logic by using instanceof operator
 
Karthick Dharani Vidhya
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for pointing me out to that particular thread.
It addresses the reason of clone() being not in Cloneable interface. Thanks for it.

Can there be a good explanation of how JVM uses these Marker Interfaces?
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check this thread
 
Karthick Dharani Vidhya
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot.

Very helpful.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Karthick Dharani Vidhya wrote:Thanks a lot.

Very helpful.


You are Welcome
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!