Printing a word every X seconds
<p>I just started learning how to use interfaces and I was trying to figure out how to print a particular word (in this case "Howdy") every 10 seconds. I used the <code>TimerTask</code> and <code>Timer</code> classes in order to schedule my task to run every 10 seconds, but am I doing it the right way?</p>

<pre><code>import java.awt.event.*;
import javax.swing.*;
import javax.swing.Timer;
import java.util.*;


public class Howdy2 {

    class PrintHowdy extends TimerTask {
        public void run() {
           System.out.println("Howdy!"); 
        }
     }

     public static void main(String[] args){
     Timer timer = new Timer();
     timer.schedule(new PrintHowdy(), 10000);

     }


}
</code></pre>
