Question: What should be the execution order, if a class has a method, static block, instance block, and constructor, as shown below? 1. public class First_C{


What should be the execution order, if a class has a method, static block, instance block, and constructor, as shown below? 1. public class First_C{ 2. public void myMethod) 3. { 4. System.out.println("Method"); 5. } 6. 7. { 8. System.out.println(" Instance Block"); 9. } 10. 11. public void First_CO 12. { 13. System.out.println("Constructor "); 14. } 15. static { 16. System.out.println("static block"); 17. } 18. public static void main(String[] args) { 19. First_C C = new First_CO; 20. C.First_CO; 21. c.myMethod(); 22. } 23. } 11. public void First_CO 12. { 13. System.out.println("Constructor "); 14. } 15. static { 16. System.out.println("static block"); 17. } 18. public static void main(String[] args) { 19. First_Cc = new First_c0; 20. C.First_CO; 21. c.myMethod(); 22. } 23. } Select one: a. Method, constructor, instance block, and static block b. Static block, method, instance block, and constructor C. Static block, instance block, constructor, and method d. Instance block, method, static block, and constructor
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
