Scope of static block in Java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Scope of static block in Java

Will static block be executed if a class is instantiated in another package or another project? If yes, at which point?

26th Dec 2018, 11:59 AM
Asirap
2 Answers
+ 1
Code in Java will only be executed if there is a call. The different between static code and other code is, that static code can be called without an instance of the class. Was this the question?
2nd Jan 2019, 11:19 PM
PapaBT
PapaBT - avatar
0
no I was asking a different question PapaBT
3rd Jan 2019, 5:00 AM
Asirap