An object instance without new ones?

As we know, we can create an instance of an object without a keyword newusing serialization of cloning classes / objects / objects. When I use these methods to create an object, is the constructor called or not?

+3
source share
2 answers

For the Object.cloneconstructor is not called.

For serialization, the most derived non-serializable constructor no-arg of the base class is called. It is usually implemented by loading a bytecode that is not verified. The constructor should be available for the basic majority of serializable classes.

+4
source

Source: https://habr.com/ru/post/1752789/


All Articles