When does the Constructor gets called in java?

前端 未结 10 1413
[愿得一人]
[愿得一人] 2020-12-16 02:14

When does the Constructor get called?

  1. Before object creation.
  2. During object creation.
  3. After object creation.
10条回答
  •  旧时难觅i
    2020-12-16 03:07

    THE JVM will first allocate the memory for your object, then initialize all fields, then invoke your constructor.

提交回复
热议问题