jQuery in Action, 3rd edition
The moose likes Beginning Java and the fly likes class.newInstance()    Vs   object.clone() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "class.newInstance()    Vs   object.clone()" Watch "class.newInstance()    Vs   object.clone()" New topic
Author

class.newInstance() Vs object.clone()

kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1396
class.newInstance() creates new instance dynamically and object.clone() creates the replica object. What is the difference(both are used for creating instances)?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10745
    
    9

Did you fully read the API docs for Object#clone() ? What would happen if you invoke the clone() on an object?


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
Have you checked out Aspose?
 
subject: class.newInstance() Vs object.clone()
 
It's not a secret anymore!