fork download
  1. class Main {
  2. public static void main(String[] args) {
  3. new Application();
  4. }
  5.  
  6. static class Application {
  7. static boolean alreadyRunning = false;
  8.  
  9. Application() {
  10. if (alreadyRunning) {
  11. System.out.println("Already running.");
  12. return;
  13. }
  14.  
  15. alreadyRunning = true;
  16. System.out.println("Starting recursive instance, just ’coz.");
  17. new Application();
  18. System.out.println("That was easy. And pointless.");
  19. }
  20. }
  21. }
Success #stdin #stdout 0.03s 245632KB
stdin
Standard input is empty
stdout
Starting recursive instance, just ’coz.
Already running.
That was easy. And pointless.