1

I saw many confusing answers about the following point :

Next, execute either the class variable initializers and static initializers of the class, or the field initializers of the interface, in textual order, as though they were a single block.

does class variable initializer include instance initliazer blocks ? and static initalizers include static block ? or does it only include variables ?

if not where does the order of intiliaztion come in the following : https://docs.oracle.com/javase/specs/jls/se8/html/jls-12.html#jls-12.4.2

eg. :

   static   {
        ...
    } // can we consider this static initializer ?

    {

    }// variable initalizer ?
    public static  String x="test"; // static initializer ?
    public String y; // variable initializer ?
Mohammad Karmi
  • 1,403
  • 3
  • 26
  • 42

0 Answers0