Is it possible to create an instance of an object in Java without calling the constructor?

Actually, yes, it is possible to bypass the constructor when you instantiate an object, if you use objenesis to instantiate the object for you. It does bytecode manipulations to achieve this.

Deserializing an object will also bypass the constructor.

It isn’t possible to do this using reflection.

Leave a Comment