title: Display a class named Time. (help troubleshooting code)
body: <p>I need to design a class named Time. The class needs to contain:</p>
  
  <p>■ Data fields hour, minute, and second that represent a time.</p>
  
  <p>■ A no-arg constructor that creates a Time object for the current time. (The values
  of the data fields will represent the current time.)</p>
  
  <p>■ A constructor that constructs a Time object with a specified elapsed time since
  midnight, Jan 1, 1970, in milliseconds. (The values of the data fields will represent
  this time.)</p>
  
  <p>■ A constructor that constructs a Time object with the specified hour, minute, and
  second.</p>
  
  <p>■ Three get methods for the data fields hour, minute, and second, respectively.</p>
  
  <p>■ A method named setTime(long elapseTime) that sets a new time for the
  object using the elapsed time.</p>
  
  <p>For this task, I have created the following code:</p>
  
  <pre><code>public class Time{
     private int hour;
     private int minute;
     private int second;
  
     public Time(){
       this(System.currentTimeMillis());
     }
  
     public Time(long elapseTime){
       long totalSeconds = elapseTime / 1000L;
       this.second = (int)(totalSeconds % 60L);
       long totalMinutes = totalSeconds / 60L;
       this.minute = (int)(totalMinutes % 60L);
       int totalHours = (int)(totalMinutes / 60L);
       this.hour = (totalHours % 24);
     }
  
     public String toString() {
       return this.hour + ":" + this.minute + ":" + this.second + " GMT";
     }
  
     public int getHour() {
       return this.hour;
     }
  
     public int getMinute() {
       return this.minute;
     }
  
     public int getSecond() {
       return this.second;
   }
  }
  </code></pre>
  
  <p>It compiles fine, but when I go to run it a dialog box pops up that says "No main methods, applets, or MIDlets found in file". Obviously my main method isn't right, but I can't seem to fix it, cause everything I've tried just creates more errors. If anyone could suggest a change to make my code work, I'd greatly appreciate it. </p>
  
  <p>Edit: Yes, I orginally had it thusly:</p>
  
  <pre><code> public class Time{
    public static void main(String args[]){...
  </code></pre>
  
  <p>but that had about a million errors. It seems I have the meat of it, but not the basic beginnings right.</p>