~/ learn/ java-from-zero/ cards/ Initialization order: static, instance, and constructor
1 of 4

Type a static initialiser block

Type a static initialiser block

Answer

static { System.out.println("class loaded once"); }

Static blocks run once when the class is first loaded — before any instance is created. Use them to initialise complex static fields.

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/8fa37489-d406-4464-b339-c068afe9014a/flashcard utf-8 LF