aspose file tools
The moose likes Java in General and the fly likes Ways to create an object? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Ways to create an object?" Watch "Ways to create an object?" New topic
Author

Ways to create an object?

Kaustubh G Sharma
Ranch Hand

Joined: May 13, 2010
Posts: 1160

How many ways we can create an object in java 3 of them i know..

1. new keyword
2. deserialization
3. class.forName()

any other way out?

kaustubh


No Kaustubh No Fun, Know Kaustubh Know Fun..
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14685
    
  16

Class#forName does not create new instances. Class#newInstance does.


[My Blog]
All roads lead to JavaRanch
Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 12953
    
    3

This question is asked regularly on the forums here. Is this some standard job interview question that a lot of people get asked?

differnt ways to create object for a class
How many ways can we create an object?
Interview question
object

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Ways to create an object?
 
Similar Threads
Create object Without new operator
In how many ways we can create an object? could you Explain with example if possible.
differnt ways to create object for a class
String object creation
How many ways can we create an object