Static Block in Java [duplicate]

I was looking over some code the other day and I came across:

static {
    ...
}

Coming from C++, I had no idea why that was there. Its not an error because the code compiled fine. What is this “static” block of code?

7 Answers
7

Leave a Comment