0

For example I have following class

public class AnyClassName {

    static {

        AnyMethodCall(anyParameters, ..., ...);
    }

    body of class ...

}

The question is what is the reason of surrounding the method: AnyMethodCall(anyParameters, ..., ...) with static { ... } ?

Pshemo
  • 122,468
  • 25
  • 185
  • 269
Renat Gatin
  • 6,053
  • 5
  • 37
  • 58
  • That is a [static initializer block](http://stackoverflow.com/questions/2420389/static-initialization-blocks) which allows to initialize static fields like some Map. – Joop Eggen Sep 08 '14 at 19:22
  • Thank you, now I understood, it calls static initializer block, and its purpose is that statements inside static are executed only once! Thanks! ) – Renat Gatin Sep 08 '14 at 19:48

0 Answers0