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
  • 118,400
  • 24
  • 176
  • 257
Renat Gatin
  • 5,402
  • 4
  • 34
  • 55
  • 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