What does it means : static {i = 5;} and which situation we use it?? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 4

What does it means : static {i = 5;} and which situation we use it??

i find this declaration in a challenge that i played and i have no idee about what does it means or which case we use this can you guys answer me

20th Jul 2017, 9:07 AM
aziz
aziz - avatar
1 Antwort
+ 2
That is a static block. Explanation found here: https://stackoverflow.com/questions/2420389/static-initialization-blocks
20th Jul 2017, 10:04 AM
Eligijus Silkartas
Eligijus Silkartas - avatar