fork(2) download
  1. import java.util.*;
  2. import java.lang.*;
  3.  
  4. public class Main
  5. {
  6. static
  7. {
  8. System.out.println("Static initialization block code");
  9. }
  10.  
  11. public Main()
  12. {
  13. System.out.println("Construtor code");
  14. }
  15.  
  16. public static void main (String[] args)
  17. {
  18. System.out.println("Main method code");
  19. Main m1 = new Main(); // Constructor code will be called here, but not the initialization
  20. Main m2 = new Main(); // Constructor code will be called again
  21. }
  22. }
Success #stdin #stdout 0.05s 215552KB
stdin
Standard input is empty
stdout
Static initialization block code
Main method code
Construtor code
Construtor code