1

Possible Duplicate:
What are all the different ways to create an object in Java?

what are the different ways that i can instantiate a class in Java other than new operator?

Community
  • 1
  • 1
Jony
  • 6,514
  • 20
  • 57
  • 70

1 Answers1

2

You can create a new object through reflection. Example:

Class cls = Class.forName("Foo");
Foo foo = cls.newInstance();

Other methods are cloning and deserialization, as you can see in the answers of this question: What are all the different ways to create an object in Java?

Community
  • 1
  • 1
True Soft
  • 8,506
  • 6
  • 51
  • 79