title: Method returns runnable object
body: <p>Can I do something like this in Java:</p>
  
  <pre><code> protected Runnable getRunnable(final int seconds) {
      Runnable runnable = new Runnable() {
          public void run() {
                  sendData();             
                  try {
                      Thread.sleep(seconds * 1000);
                  } 
                  catch (InterruptedException e) {
                      Thread.currentThread().interrupt();
                  }
          }
      };
      return runnable;
  }
  </code></pre>
  
  <p>And then:</p>
  
  <pre><code>protected void startTimer(int seconds) throws InterruptedException,NullPointerException {
      Thread thread = new Thread(getRunnable(seconds));
      thread.start();
  }
  </code></pre>
  
  <p>Is the aforementioned process safe??</p>