Hello friends.

Can anybody tell me how many ways exist to create the instance of class. i know only two ways to create the instance of class.
1. using new operator
2. using Class.forName()

can anybody tell me more method. someone told me that there is more than 5 method to create the instance of class.

thanks in advance

8 Years
Discussion Span
Last Post by pankajagar2002

Yes you can found more information in the the java language specification 3.0
precisely the chapter 12
12-2 Loading of calsses and Interfaces.
hope it helps.


No help, i check the java language specification 3.0 and not able to find the satisfactory answer, i also check the point 12.5 Creation of New Class Instances but still not happy. could you please tell me.

sorry if i am asking wrong question or in wrong section.


So check the javaDoc of the classLoader; or just read the ClassLoader.java in the package java.lang.

hope it helps.


In fact I did not now in what context you'r working in; but the aproche I'm tolking about is when you'r writing a dynamique proxy class generator or aspect weaver.


OK, one of my friend told me four way to create the instance of class or you can say the way of creation of object.

1. new operator
2. Class.forName()
3. .clone() method
4. deserialzation

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.