I am getting ready for a java certification exam and I have seen code LIKE this in one of the practice tests:
class Foo { int x = 1; public sta
It's an initializer block. It's used to set instance variables. The motivation to use initializer blocks over constructors is to prevent writing redundant code. The Java compiler copies the contents of the block into each constructor.