File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes class.newInstance()    Vs   object.clone() Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply 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: 1300
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: 8430

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


[Donate a pint, save a life!] [How to ask questions] [Onff-turn it on!]
 
I agree. Here's the link: http://jrebel.com/download
 
subject: class.newInstance() Vs object.clone()
 
Similar Threads
Using Class.forName() with constructor arguments
creation of object
how many type or how many kind of way we can create an object in java??
ways of instantiation
class Class and class literals