title: Main thread exits before the completion of CompletableFuture
body: <pre><code>    CompletableFuture feature = CompletableFuture.supplyAsync (() -&gt;       composeMethod ( )).
              thenAccept (s -&gt; System.out.println ("wassup java" + s)).
              thenRun (() -&gt; System.out.println (" imm immortal"));
      nonblockingmethod ( );
  </code></pre>
  
  <p>This is the CompletableFuture future example im working on </p>
  
  <pre><code>private static void nonblockingmethod() {
          System.out.println ("why  should i wait for you ");
      }
  
      private static String composeMethod() {
          try {
              TimeUnit.MILLISECONDS.sleep (3);
              File file = Paths.get ("/Users/solo/solo1.txt").toFile ( );
  
              if (!file.exists ( )) {
                  file.createNewFile ( );
              }
  
          } catch (Exception e) {
  
          }
          return "   resultdaa";
      }
  </code></pre>
  
  <p>first i call compose method from supplyAsync , where i execute the method composeMethod , there is a three millisecond delay and then it will create a file and return a string as result . after its completion i call thenRun method which just prints a method , After that there is a nonblockingmethod which runs from the main thread .</p>
  
  <p>the problem i face here is the main Thread finish executing the nonblockingmethod() and exits the process before the 3 millisecond delay while  the subsequent operation from composeMethod. is this teh expected behaviour or i have to block the main thread using get or join , or i miss anything</p>