What should be the execution order, if a class has a method, static block, instance block, and constructor, as shown below?public class First_C {        public void myMethod()       {      System.out.println('Method');      }             {      System.out.println(' Instance Block');      }                public void First_C()      {      System.out.println('Constructor ');      }      static {         System.out.println('static block');      }      public static void main(String[] args) {      First_C c = new First_C();      c.First_C();      c.myMethod();    }  }    - Study24x7
Social learning Network
13 Feb 2024 11:43 AM study24x7 study24x7

What should be the execution order, if a class has a method, static block, instance block, and constructor, as shown below?
public class First_C {
        public void myMethod()
    &nbs...

See more

A

Instance block, method, static block, and constructor

B

Method, constructor, instance block, and static block

C

Static block, method, instance block, and constructor

D

Static block, instance block, constructor, and method

study24x7
Write a comment
Related Questions
500+   more Questions to answer
Most Related Articles