Static Block
Ever wanted code to run just once? Use a static block.
static {
System.out.println("App loaded");
}
Runs only once when the class is loaded.
Great for initialization.
#JavaTricks#DevCommunity#static#block#ayshriv#java
In Java, double brace initialization is the combination of 2️⃣ separate processes where the first brace is used to create an anonymous inner class & the second brace is used as an initialization block.
#java#javaprogramming#javatricks#programming#software#developers
Totally agree. It's just unsettling and a little bit scary when you realize that even otherwise intelligent and decent people have made a conscious decision, for whatever reason, to support such a monster.