0
Why Instance Initializer block is not executed ...??
I have been read Instance Initializer blocks are executed before constructor runs ... but if I didn't create any constructors and even I didn't create an object why Instance Initializer blocks are run .. 🤔😐 please explain why ...?? https://code.sololearn.com/cLI9cqh8VDyB/?ref=app
6 Antworten
+ 1
♡Nani♡ it will get called only if you create an instance of the class..
Program program = new Program();
+ 2
Please provide a link for this code.
+ 2
This is a method and can be executed in main.
+ 1
cause jvm doesnt create an instance of the program class..it just simply call the static main method
prob what u want is static initialization block
+ 1
Lily Mea no I am talking about normal instance blocks
0
Lily Mea thanks 😊