• Post Reply Bookmark Topic Watch Topic
  • New Topic

Doubt in clone Method of Object Class  RSS feed

 
Thennam Pandian
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Friends,

we know that clone Method will create a bitwise copy of an object

and the constructor is not called .


if the constructor is not called ,then how the memory for that object is

allocated ?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
clone() on Object is a native method. I'd guess the JVM does some voodoo magic that is not normal Java like you and I could write.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Constructors never allocate the memory for an object; that's done by a few specific JVM bytecodes.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!