How to use A non-static initialization blocks?

Executed for each object that is created.
Can initialize instance variables in a class.
public class MainClass {
static int[] values = new int[5];

{
System.out.println(“Running initialization block.”);
for (int i = 0; i < values.length; i++) {
values[i] = (int) (100.0 * Math.random());
}
}

void listValues() {

for (int value : values) {
  System.out.println(value);
}

}

public static void main(String[] args) {
MainClass example = new MainClass();
System.out.println("
First object:");
example.listValues();

example = new MainClass();
System.out.println("

Second object:");
example.listValues();
}
}
Running initialization block.

First object:
35
17
1
42
7
Running initialization block.

Second object:
45
78
49
56
38