![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeaQSPbyLpIJI1FruPnPJkiX9PdquMu67TILB2YIqLuWnzqCbld6ROElDmz5QuVWCbHDG0y_5LJaACQOhYniNLI_rW5inPpF-CIIhz80JcTDGRlsJDqMZu2jZIgFLjhyn9SiEpg3C_Rh4p/s320/obi.jpg)
Object block initializor in Java is a code block in parenthesisexecuted before the class constructor. I always thought it was a bad idea because by default I expect all initialization code in a constructor. In addition, I have never seen such initializors used anywhere except for Java textbooks and interview questions.
Yesterday I for the first time read about a potentially useful way to utilize them. The idea is to save some typing (compare creation of b1 and b2):